A credential capable of handling most Azure SDK authentication scenarios. For more information, See Usage guidance for DefaultAzureCredential.
The identity it uses depends on the environment. When an access token is needed, it requests one using these identities in turn, stopping when one provides a token:
A service principal configured by environment variables. See EnvironmentCredential for more details.
WorkloadIdentityCredential if environment variable configuration is set by the Azure workload identity webhook.
An Azure managed identity. See ManagedIdentityCredential for more details.
On Windows only: a user who has signed in with a Microsoft application, such as Visual Studio. If multiple identities are in the cache, then the value of the environment variable AZURE_USERNAME
is used to select which identity to use. See SharedTokenCacheCredential for more details.
The identity currently logged in to the Azure CLI.
The identity currently logged in to Azure PowerShell.
The identity currently logged in to the Azure Developer CLI.
Brokered authentication. On Windows and WSL only, this uses the default account logged in via Web Account Manager (WAM) if the azure-identity-broker package is installed.
This default behavior is configurable with keyword arguments.
ConstructorDefaultAzureCredential(**kwargs: Any)
Keyword-Only Parameters Examples
Create a DefaultAzureCredential.
from azure.identity import DefaultAzureCredential
credential = DefaultAzureCredential()
Methods close
Close the transport session of each credential in the chain.
get_tokenRequest an access token for scopes.
This method is called automatically by Azure SDK clients.
get_token_infoRequest an access token for scopes.
This is an alternative to get_token to enable certain scenarios that require additional properties on the token. This method is called automatically by Azure SDK clients.
closeClose the transport session of each credential in the chain.
close() -> None
get_token
Request an access token for scopes.
This method is called automatically by Azure SDK clients.
get_token(*scopes: str, claims: str | None = None, tenant_id: str | None = None, **kwargs: Any) -> AccessToken
Parameters Keyword-Only Parameters Returns Exceptions get_token_info
Request an access token for scopes.
This is an alternative to get_token to enable certain scenarios that require additional properties on the token. This method is called automatically by Azure SDK clients.
get_token_info(*scopes: str, options: TokenRequestOptions | None = None) -> AccessTokenInfo
Parameters Keyword-Only Parameters Returns Exceptions
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide. In this articleWas this page helpful?
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4