Skip to content

Commit 16b176a

Browse files
committed
Adjusting error message and docs
1 parent fd0c94b commit 16b176a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

msal/managed_identity.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,15 @@ def acquire_token_for_client(self, resource=None):
172172
173173
The result will be automatically cached.
174174
Subsequent calls will automatically seaarch from cache first.
175+
176+
.. note::
177+
178+
Known issue: When an Azure VM has only one user-assigned managed identity,
179+
and your app specifies to use system-assigned managed identity,
180+
Azure VM may still return a token for your user-assigned identity.
181+
182+
This is a service-side behavior that cannot be changed by this library.
183+
`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>`_
175184
"""
176185
if not resource:
177186
raise ValueError(
@@ -266,7 +275,7 @@ def _obtain_token(http_client, managed_identity, resource):
266275
if "IDENTITY_ENDPOINT" in os.environ and "IMDS_ENDPOINT" in os.environ:
267276
if ManagedIdentity.is_user_assigned(managed_identity):
268277
raise ValueError( # Note: Azure Identity for Python raised exception too
269-
"Ignoring managed_identity parameter. "
278+
"Invalid managed_identity parameter. "
270279
"Azure Arc supports only system-assigned managed identity, "
271280
"See also "
272281
"https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service")

0 commit comments

Comments
 (0)