AzurePowerShellCredential Class

Authenticates by requesting a token from Azure PowerShell.

This requires previously logging in to Azure via "Connect-AzAccount", and will use the currently logged in identity.

Inheritance
azure.identity.aio._internal.AsyncContextManager
AzurePowerShellCredential

Constructor

AzurePowerShellCredential()

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

async 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.

async 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 Azure PowerShell, or no account is authenticated

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