@@ -217,7 +217,7 @@ def login(self,
217217
218218 def login_with_managed_identity (self , identity_id = None , allow_no_subscriptions = None ):
219219 identity_type = None
220- if _on_azure_arc ():
220+ if _msal_managed_identity ():
221221 identity_type = MsiAccountTypes .system_assigned
222222 from .auth .msal_authentication import ManagedIdentityCredential
223223 cred = ManagedIdentityCredential ()
@@ -372,7 +372,7 @@ def get_login_credentials(self, resource=None, client_id=None, subscription_id=N
372372 resource = resource )
373373 else :
374374 # managed identity
375- if _on_azure_arc ():
375+ if _msal_managed_identity ():
376376 from .auth .msal_authentication import ManagedIdentityCredential
377377 cred = ManagedIdentityCredential ()
378378 else :
@@ -402,7 +402,7 @@ def get_raw_token(self, resource=None, scopes=None, subscription=None, tenant=No
402402 if tenant :
403403 raise CLIError ("Tenant shouldn't be specified for managed identity account" )
404404 from .auth .util import scopes_to_resource
405- if _on_azure_arc ():
405+ if _msal_managed_identity ():
406406 from .auth .msal_authentication import ManagedIdentityCredential
407407 cred = ManagedIdentityCredential ()
408408 else :
@@ -917,5 +917,9 @@ def _create_identity_instance(cli_ctx, *args, **kwargs):
917917 instance_discovery = instance_discovery , ** kwargs )
918918
919919
920- def _on_azure_arc ():
921- return "IDENTITY_ENDPOINT" in os .environ and "IMDS_ENDPOINT" in os .environ
920+ def _msal_managed_identity ():
921+ # Azure Arc
922+ if "IDENTITY_ENDPOINT" in os .environ and "IMDS_ENDPOINT" in os .environ :
923+ logger .debug ("Azure Arc detected" )
924+ return True
925+ return False
0 commit comments