Skip to content

Commit

Permalink
{Auth} Do not wrap MSIAuthenticationWrapper with CredentialAdaptor (
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli authored Mar 6, 2025
1 parent 2690e05 commit 939778e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/azure-cli-core/azure/cli/core/_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,10 @@ def _create_subscription_client(self, credential):
raise CLIInternalError("Unable to get '{}' in profile '{}'"
.format(ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS, self.cli_ctx.cloud.profile))
api_version = get_api_version(self.cli_ctx, ResourceType.MGMT_RESOURCE_SUBSCRIPTIONS)
sdk_cred = CredentialAdaptor(credential)

# MSIAuthenticationWrapper already implements get_token, so no need to wrap it with CredentialAdaptor
from azure.cli.core.auth.adal_authentication import MSIAuthenticationWrapper
sdk_cred = credential if isinstance(credential, MSIAuthenticationWrapper) else CredentialAdaptor(credential)
client_kwargs = _prepare_mgmt_client_kwargs_track2(self.cli_ctx, sdk_cred)
client = client_type(sdk_cred, api_version=api_version,
base_url=self.cli_ctx.cloud.endpoints.resource_manager,
Expand Down

0 comments on commit 939778e

Please sign in to comment.