简体   繁体   中英

How to query SQL Server from python based Azure Function on local environment using Managed Identity

I am using an Azure function having managed identity and connected to Azure SQL Server. My Azure function is using Python. Is there a way to test the Azure function on your local environment, in this scenario? I found couple of examples using .net though could not find any which is using python to test Azure function locally with managed identity enabled.

Thanks for your help on this.

If you are using DefaultAzureCredential from the azure-identity library, when running locally it expects the following environment variables for a service principal that would need access to the SQL Server as well.

  • AZURE_TENANT_ID
  • AZURE_CLIENT_ID
  • AZURE_CLIENT_SECRET

You can read more about how azure-identity works from the official docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM