Skip to content

Commit

Permalink
Adjusting error message and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rayluo committed Aug 18, 2023
1 parent fd0c94b commit 16b176a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion msal/managed_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,15 @@ def acquire_token_for_client(self, resource=None):
The result will be automatically cached.
Subsequent calls will automatically seaarch from cache first.
.. note::
Known issue: When an Azure VM has only one user-assigned managed identity,
and your app specifies to use system-assigned managed identity,
Azure VM may still return a token for your user-assigned identity.
This is a service-side behavior that cannot be changed by this library.
`Azure VM docs <https://learn.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/how-to-use-vm-token#get-a-token-using-http>`_
"""
if not resource:
raise ValueError(
Expand Down Expand Up @@ -266,7 +275,7 @@ def _obtain_token(http_client, managed_identity, resource):
if "IDENTITY_ENDPOINT" in os.environ and "IMDS_ENDPOINT" in os.environ:
if ManagedIdentity.is_user_assigned(managed_identity):
raise ValueError( # Note: Azure Identity for Python raised exception too
"Ignoring managed_identity parameter. "
"Invalid managed_identity parameter. "
"Azure Arc supports only system-assigned managed identity, "
"See also "
"https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service")
Expand Down

0 comments on commit 16b176a

Please sign in to comment.