Skip to content

Commit 1cd2498

Browse files
committed
mi-cred
1 parent f1c5229 commit 1cd2498

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/azure-cli-core/azure/cli/core/_profile.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,9 @@ def _create_subscription_client(self, credential):
926926
raise CLIInternalError("Unable to get '{}' in profile '{}'"
927927
.format(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS, self.cli_ctx.cloud.profile))
928928
api_version = get_api_version(self.cli_ctx, ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS)
929-
sdk_cred = CredentialAdaptor(credential)
929+
930+
# MSIAuthenticationWrapper already implements get_token, so no need to wrap it with CredentialAdaptor
931+
sdk_cred = credential if hasattr(credential, 'get_token') else CredentialAdaptor(credential)
930932
client_kwargs = _prepare_mgmt_client_kwargs_track2(self.cli_ctx, sdk_cred)
931933
client = client_type(sdk_cred, api_version=api_version,
932934
base_url=self.cli_ctx.cloud.endpoints.resource_manager,

0 commit comments

Comments
 (0)