AzureCliCredential Class

Authenticates by requesting a token from the Azure CLI.

This requires previously logging in to Azure via "az login", and will use the CLI's currently logged in identity.

Inheritance
builtins.object
AzureCliCredential

Constructor

AzureCliCredential()

Methods

close

Calling this method is unnecessary.

get_token

Request an access token for scopes.

This method is called automatically by Azure SDK clients. Applications calling this method directly must also handle token caching because this credential doesn't cache the tokens it acquires.

close

Calling this method is unnecessary.

close() -> None

get_token

Request an access token for scopes.

This method is called automatically by Azure SDK clients. Applications calling this method directly must also handle token caching because this credential doesn't cache the tokens it acquires.

get_token(*scopes: str, **kwargs: Any) -> AccessToken

Parameters

scopes
str
Required

desired scope for the access token. This credential allows only one scope per request.

tenant_id
str

optional tenant to include in the token request.

Return type

Exceptions

the credential was unable to invoke the Azure CLI.

the credential invoked the Azure CLI but didn't receive an access token.