diff --git a/src/azure-cli-core/azure/cli/core/_profile.py b/src/azure-cli-core/azure/cli/core/_profile.py index ee2cd6d9de6..2fe00c649fe 100644 --- a/src/azure-cli-core/azure/cli/core/_profile.py +++ b/src/azure-cli-core/azure/cli/core/_profile.py @@ -220,7 +220,7 @@ def login(self, return deepcopy(consolidated) def login_with_managed_identity(self, identity_id=None, allow_no_subscriptions=None): - if _on_azure_arc_windows(): + if _on_azure_arc(): return self.login_with_managed_identity_azure_arc_windows( identity_id=identity_id, allow_no_subscriptions=allow_no_subscriptions) @@ -390,7 +390,7 @@ def get_login_credentials(self, resource=None, client_id=None, subscription_id=N elif managed_identity_type: # managed identity - if _on_azure_arc_windows(): + if _on_azure_arc(): from .auth.msal_credentials import ManagedIdentityCredential from azure.cli.core.auth.credential_adaptor import CredentialAdaptor # The credential must be wrapped by CredentialAdaptor so that it can work with Track 1 SDKs. @@ -451,7 +451,7 @@ def get_raw_token(self, resource=None, scopes=None, subscription=None, tenant=No # managed identity if tenant: raise CLIError("Tenant shouldn't be specified for managed identity account") - if _on_azure_arc_windows(): + if _on_azure_arc(): from .auth.msal_credentials import ManagedIdentityCredential cred = ManagedIdentityCredential() else: @@ -960,6 +960,7 @@ def _create_identity_instance(cli_ctx, *args, **kwargs): instance_discovery=instance_discovery, **kwargs) -def _on_azure_arc_windows(): - # This indicates an Azure Arc-enabled Windows server - return "IDENTITY_ENDPOINT" in os.environ and "IMDS_ENDPOINT" in os.environ +def _on_azure_arc(): + # This indicates an Azure Arc-enabled server + from msal.managed_identity import get_managed_identity_source, AZURE_ARC + return get_managed_identity_source() == AZURE_ARC diff --git a/src/azure-cli-core/setup.py b/src/azure-cli-core/setup.py index e3f299d2c26..742b12a6995 100644 --- a/src/azure-cli-core/setup.py +++ b/src/azure-cli-core/setup.py @@ -53,7 +53,7 @@ 'jmespath', 'knack~=0.11.0', 'msal-extensions==1.2.0', - 'msal[broker]==1.31.0', + 'msal[broker]==1.31.1', 'msrestazure~=0.6.4', 'packaging>=20.9', 'pkginfo>=1.5.0.1', diff --git a/src/azure-cli/requirements.py3.Darwin.txt b/src/azure-cli/requirements.py3.Darwin.txt index 5e8c50467b3..83436438264 100644 --- a/src/azure-cli/requirements.py3.Darwin.txt +++ b/src/azure-cli/requirements.py3.Darwin.txt @@ -104,7 +104,7 @@ jmespath==0.9.5 jsondiff==2.0.0 knack==0.11.0 msal-extensions==1.2.0 -msal[broker]==1.31.0 +msal[broker]==1.31.1 msrest==0.7.1 msrestazure==0.6.4 oauthlib==3.2.2 diff --git a/src/azure-cli/requirements.py3.Linux.txt b/src/azure-cli/requirements.py3.Linux.txt index 5c6f696065d..4d4b3d0e48a 100644 --- a/src/azure-cli/requirements.py3.Linux.txt +++ b/src/azure-cli/requirements.py3.Linux.txt @@ -105,7 +105,7 @@ jmespath==0.9.5 jsondiff==2.0.0 knack==0.11.0 msal-extensions==1.2.0 -msal[broker]==1.31.0 +msal[broker]==1.31.1 msrest==0.7.1 msrestazure==0.6.4 oauthlib==3.2.2 diff --git a/src/azure-cli/requirements.py3.windows.txt b/src/azure-cli/requirements.py3.windows.txt index a9ea7a46afb..5bbae9861a0 100644 --- a/src/azure-cli/requirements.py3.windows.txt +++ b/src/azure-cli/requirements.py3.windows.txt @@ -104,7 +104,7 @@ jmespath==0.9.5 jsondiff==2.0.0 knack==0.11.0 msal-extensions==1.2.0 -msal[broker]==1.31.0 +msal[broker]==1.31.1 msrest==0.7.1 msrestazure==0.6.4 oauthlib==3.2.2