A sequence of credentials that is itself a credential.
Its get_token method calls get_token
on each credential in the sequence, in order, returning the first valid token received. For more information, see ChainedTokenCredential overview.
ChainedTokenCredential(*credentials: TokenCredential | SupportsTokenInfo)
Parameters Examples
Create a ChainedTokenCredential.
from azure.identity import ChainedTokenCredential, EnvironmentCredential, AzureCliCredential
credential_chain = (
# Try EnvironmentCredential first
EnvironmentCredential(),
# Fallback to Azure CLI if EnvironmentCredential fails
AzureCliCredential(),
)
credential = ChainedTokenCredential(*credential_chain)
Methods close
Close the transport session of each credential in the chain.
get_tokenRequest a token from each chained credential, in order, returning the first token received.
If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.
This method is called automatically by Azure SDK clients.
get_token_infoRequest a token from each chained credential, in order, returning the first token received.
If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.
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 a token from each chained credential, in order, returning the first token received.
If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.
This method is called automatically by Azure SDK clients.
get_token(*scopes: str, claims: str | None = None, tenant_id: str | None = None, enable_cae: bool = False, **kwargs: Any) -> AccessToken
Parameters Keyword-Only Parameters Returns Exceptions get_token_info
Request a token from each chained credential, in order, returning the first token received.
If no credential provides a token, raises ClientAuthenticationError with an error message from each credential.
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