managed_identity Module
Classes
ArcPlatformNotSupportedError | |
ManagedIdentity |
Feed an instance of this class to <xref:msal.ManagedIdentityClient> to acquire token for the specified managed identity. |
ManagedIdentityClient |
This API encapsulates multiple managed identity back-ends: VM, App Service, Azure Automation (Runbooks), Azure Function, Service Fabric, and Azure Arc. It also provides token cache support. Note Cloud Shell support is NOT implemented in this class. Since MSAL Python 1.18 in May 2022, it has been implemented in <xref:PublicClientApplication.acquire_token_interactive> via calling pattern PublicClientApplication(...).acquire_token_interactive(scopes=[...], prompt="none"). That is appropriate, because Cloud Shell yields a token with delegated permissions for the end user who has signed in to the Azure Portal (like what a PublicClientApplication does), not a token with application permissions for an app. Create a managed identity client. Recipe 1: Hard code a managed identity for your app:
Recipe 2: Write once, run everywhere.
If you use different managed identity on different deployment,
you may use an environment variable (such as MY_MANAGED_IDENTITY_CONFIG)
to store a json blob like
|
ManagedIdentityError | |
SystemAssignedManagedIdentity |
Represent a system-assigned managed identity. It is equivalent to a Python dict of:
or a JSON blob of:
|
UserAssignedManagedIdentity |
Represent a user-assigned managed identity. Depends on the id you provided, the outcome is equivalent to one of the below:
|
Functions
get_managed_identity_source
Detect the current environment and return the likely identity source.
When this function returns CLOUD_SHELL
, you should use
<xref:msal.PublicClientApplication.acquire_token_interactive> with prompt="none"
to obtain a token.
get_managed_identity_source()