ManagedIdentityCredential Class

Authenticates with an Azure managed identity in any hosting environment which supports managed identities.

This credential defaults to using a system-assigned identity. To configure a user-assigned identity, use one of the keyword arguments. See Azure Active Directory documentation for more information about configuring managed identity for applications.

Inheritance
builtins.object
ManagedIdentityCredential

Constructor

ManagedIdentityCredential(**kwargs: Any)

Parameters

client_id
str

a user-assigned identity's client ID or, when using Pod Identity, the client ID of an Azure AD app registration. This argument is supported in all hosting environments.

identity_config
<xref:Mapping>[str, str]

a mapping {parameter_name: value} specifying a user-assigned identity by its object or resource ID, for example {"object_id": "..."}. Check the documentation for your hosting environment to learn what values it expects.

Methods

close

Close the credential's transport session.

get_token

Request an access token for scopes.

This method is called automatically by Azure SDK clients.

close

Close the credential's transport session.

close() -> None

get_token

Request an access token for scopes.

This method is called automatically by Azure SDK clients.

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.

Return type

Exceptions

managed identity isn't available in the hosting environment