Azure / azure-workload-identity

Azure AD Workload Identity uses Kubernetes primitives to associate managed identities for Azure resources and identities in Azure Active Directory (AAD) with pods.
https://azure.github.io/azure-workload-identity
MIT License
289 stars 86 forks source link

Workaround for using ODBC driver with workload identity #1157

Open tianqi-z opened 8 months ago

tianqi-z commented 8 months ago

Hi WI team, Any chances ODBC driver is supporting workload identity now? If not, could you share some details of any workaround we can use? It took me forever to find this https://techcommunity.microsoft.com/t5/azure-database-support-blog/lesson-learned-384-odbc-driver-not-supporting-aks-workload/ba-p/3858209 At lease mention this in the workload identity doc? This doc https://learn.microsoft.com/en-us/sql/connect/odbc/using-azure-active-directory?view=sql-server-ver16#azure-active-directory-authentication-sample-code only mentioned c++ for the access token authentication. How to achieve the same for C# System.Data.Odbc.OdbcConnection? Thanks

thomasfrederikhoeck commented 4 months ago

@tianqi-z these links helped me with Python where we now are using ODBC with workload identity. They might help you for C#:

https://docs.sqlalchemy.org/en/20/dialects/mssql.html#connecting-to-databases-with-access-tokens

https://learn.microsoft.com/en-us/azure/azure-sql/database/azure-sql-passwordless-migration-python?view=azuresql&tabs=sign-in-azure-cli%2Cazure-portal-create%2Cazure-portal-assign%2Capp-service-identity#update-the-local-connection-configuration

https://stackoverflow.com/questions/57193301/pass-azure-ad-token-for-azure-sql-db-in-pre-connection-arguments-to-sqlalchemy-c

https://learn.microsoft.com/en-us/sql/connect/odbc/using-azure-active-directory?view=sql-server-ver16#authenticating-with-an-access-token