@@ -551,12 +551,16 @@ def get_subscription_id(self, subscription=None): # take id or name
551551
552552 @staticmethod
553553 def _parse_managed_identity_info (account ):
554- # No longer works with the login profile created by versions < 2.0.51
555- # https://github.com/Azure/azure-cli/pull/7744
556554 identity_info = account [_USER_ENTITY ].get (_ASSIGNED_IDENTITY_INFO )
557555 user_name = account [_USER_ENTITY ].get (_USER_NAME )
558556
559557 if user_name in [_SYSTEM_ASSIGNED_IDENTITY , _USER_ASSIGNED_IDENTITY ]:
558+ # We no longer support login profile created by versions < 2.0.51, which uses _SUBSCRIPTION_NAME as
559+ # _ASSIGNED_IDENTITY_INFO.
560+ # https://github.com/Azure/azure-cli/pull/7744
561+ if not identity_info :
562+ raise CLIError (f'{ _ASSIGNED_IDENTITY_INFO } property is missing from the current account. '
563+ 'Please run `az login --identity`.' )
560564 parts = identity_info .split ('-' , 1 )
561565 return parts [0 ], (None if len (parts ) <= 1 else parts [1 ])
562566 return None , None
@@ -701,7 +705,7 @@ def credential_factory(identity_type, identity_id):
701705 return ManagedIdentityCredential (object_id = identity_id )
702706 if identity_type == ManagedIdentityAuth .user_assigned_resource_id :
703707 return ManagedIdentityCredential (msi_res_id = identity_id )
704- raise ValueError ("unrecognized msi account name '{}'" .format (identity_type ))
708+ raise ValueError ("unrecognized managed identity account name '{}'" .format (identity_type ))
705709
706710
707711class SubscriptionFinder :
0 commit comments