Hello Diksha Singh
I believe you are using Managed Identity Authentication
DefaultAzureCredential
and ManagedIdentityCredential
support managed identity authentication in any hosting environment which supports managed identities, such as (this list is not exhaustive):
- Azure Virtual Machines
- Azure App Service
- Azure Kubernetes Service
- Azure Cloud Shell
- Azure Arc
- Azure Service Fabric
DefaultAzureCredential and EnvironmentCredential can be configured with environment variables. Each type of authentication requires values for specific variables:
AZURE_CLIENT_ID |
id of an Azure Active Directory application |
AZURE_TENANT_ID |
id of the application’s Azure Active Directory tenant |
AZURE_CLIENT_SECRET |
one of the application’s client secrets |
Managed Identity flow
from azure.identity import ManagedIdentityCredential
credential = ManagedIdentityCredential()
# Can also specify a client ID of a user-assigned managed identity
credential = ManagedIdentityCredential(
client_id="<client_id>",
)
https://azuresdkdocs.blob.core.windows.net/$web/python/azure-identity/1.6.0/index.html