Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions msal/managed_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __init__(
self,
managed_identity: Union[
dict,
ManagedIdentity, # Could use Type[ManagedIdentity] but it is deprecatred in Python 3.9+
ManagedIdentity, # Could use Type[ManagedIdentity] but it is deprecated in Python 3.9+
SystemAssignedManagedIdentity,
UserAssignedManagedIdentity,
],
Expand Down Expand Up @@ -206,7 +206,7 @@ def __init__(
you may use an environment variable (such as MY_MANAGED_IDENTITY_CONFIG)
to store a json blob like
``{"ManagedIdentityIdType": "ClientId", "Id": "foo"}`` or
``{"ManagedIdentityIdType": "SystemAssignedManagedIdentity", "Id": null})``.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ) symbol is not needed.

``{"ManagedIdentityIdType": "SystemAssigned", "Id": null}``.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The detection logic is to compare ManagedIdentityIdType's value with "SystemAssigned":

and unknown.get(cls.ID_TYPE) == cls.SYSTEM_ASSIGNED)

Using "SystemAssignedManagedIdentity" will trigger error:

raise ManagedIdentityError(
f"Incorrect managed_identity: {managed_identity}")

The following app can load managed identity configuration dynamically::

import json, os, msal, requests
Expand Down Expand Up @@ -648,4 +648,3 @@ def _obtain_token_on_arc(http_client, endpoint, resource):
"error": "invalid_request",
"error_description": response.text,
}