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
19 changes: 1 addition & 18 deletions msal/managed_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,6 @@ class ManagedIdentityClient(object):

It also provides token cache support.

.. admonition:: Special case when your local development wants to use a managed identity on Azure VM.

By setting the environment variable ``MSAL_MANAGED_IDENTITY_ENDPOINT``
you override the default identity URL used in MSAL's Azure VM managed identity
code path.

This is useful during local development where it may be desirable to
utilise the credentials assigned to an actual VM instance via SSH tunnelling.

For example, if you create your SSH tunnel this way (assuming your VM is on ``192.0.2.1``)::

ssh -L 8000:169.254.169.254:80 192.0.2.1

Then your code could run locally using::

env MSAL_MANAGED_IDENTITY_ENDPOINT=http://localhost:8000/metadata/identity/oauth2/token python your_script.py

.. note::

Cloud Shell support is NOT implemented in this class.
Expand Down Expand Up @@ -463,7 +446,7 @@ def _obtain_token_on_azure_vm(http_client, managed_identity, resource):
}
_adjust_param(params, managed_identity)
resp = http_client.get(
os.getenv('MSAL_MANAGED_IDENTITY_ENDPOINT', 'http://169.254.169.254/metadata/identity/oauth2/token'),
"http://169.254.169.254/metadata/identity/oauth2/token",
params=params,
headers={"Metadata": "true"},
)
Expand Down