@@ -220,8 +220,8 @@ def login(self,
220220 return deepcopy (consolidated )
221221
222222 def login_with_managed_identity (self , identity_id = None , allow_no_subscriptions = None ):
223- if _on_azure_arc_windows ():
224- return self .login_with_managed_identity_azure_arc_windows (
223+ if _on_azure_arc ():
224+ return self .login_with_managed_identity_azure_arc (
225225 identity_id = identity_id , allow_no_subscriptions = allow_no_subscriptions )
226226
227227 import jwt
@@ -286,7 +286,7 @@ def login_with_managed_identity(self, identity_id=None, allow_no_subscriptions=N
286286 self ._set_subscriptions (consolidated )
287287 return deepcopy (consolidated )
288288
289- def login_with_managed_identity_azure_arc_windows (self , identity_id = None , allow_no_subscriptions = None ):
289+ def login_with_managed_identity_azure_arc (self , identity_id = None , allow_no_subscriptions = None ):
290290 import jwt
291291 identity_type = MsiAccountTypes .system_assigned
292292 from .auth .msal_credentials import ManagedIdentityCredential
@@ -388,7 +388,7 @@ def get_login_credentials(self, resource=None, subscription_id=None, aux_subscri
388388
389389 elif managed_identity_type :
390390 # managed identity
391- if _on_azure_arc_windows ():
391+ if _on_azure_arc ():
392392 from .auth .msal_credentials import ManagedIdentityCredential
393393 from azure .cli .core .auth .credential_adaptor import CredentialAdaptor
394394 # The credential must be wrapped by CredentialAdaptor so that it can work with Track 1 SDKs.
@@ -449,7 +449,7 @@ def get_raw_token(self, resource=None, scopes=None, subscription=None, tenant=No
449449 # managed identity
450450 if tenant :
451451 raise CLIError ("Tenant shouldn't be specified for managed identity account" )
452- if _on_azure_arc_windows ():
452+ if _on_azure_arc ():
453453 from .auth .msal_credentials import ManagedIdentityCredential
454454 cred = ManagedIdentityCredential ()
455455 else :
@@ -960,6 +960,7 @@ def _create_identity_instance(cli_ctx, authority, tenant_id=None, client_id=None
960960 instance_discovery = instance_discovery )
961961
962962
963- def _on_azure_arc_windows ():
964- # This indicates an Azure Arc-enabled Windows server
965- return "IDENTITY_ENDPOINT" in os .environ and "IMDS_ENDPOINT" in os .environ
963+ def _on_azure_arc ():
964+ # This indicates an Azure Arc-enabled server
965+ from msal .managed_identity import get_managed_identity_source , AZURE_ARC
966+ return get_managed_identity_source () == AZURE_ARC
0 commit comments