From e3edb2ae3c866fe6c1c171db871bb8d3af4a2fd1 Mon Sep 17 00:00:00 2001 From: jiasli <4003950+jiasli@users.noreply.github.com> Date: Fri, 7 Feb 2025 17:02:23 +0800 Subject: [PATCH] batch-credential-scopes --- .../azure/cli/command_modules/batch/_client_factory.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/batch/_client_factory.py b/src/azure-cli/azure/cli/command_modules/batch/_client_factory.py index 27a15466ae1..07b6c8fb463 100644 --- a/src/azure-cli/azure/cli/command_modules/batch/_client_factory.py +++ b/src/azure-cli/azure/cli/command_modules/batch/_client_factory.py @@ -50,9 +50,9 @@ def batch_data_client_factory(cli_ctx, kwargs): if not token_credential and not account_key: from azure.cli.core._profile import Profile + from azure.cli.core.auth.util import resource_to_scopes profile = Profile(cli_ctx=cli_ctx) - resource = cli_ctx.cloud.endpoints.batch_resource_id - token_credential, _, _ = profile.get_login_credentials(resource=resource) + token_credential, _, _ = profile.get_login_credentials() if account_key: from azure.core.credentials import AzureNamedKeyCredential @@ -64,4 +64,5 @@ def batch_data_client_factory(cli_ctx, kwargs): account_endpoint.startswith('http://')): account_endpoint = 'https://' + account_endpoint - return BatchClient(credential=credential, endpoint=account_endpoint.rstrip('/')) + return BatchClient(credential=credential, endpoint=account_endpoint.rstrip('/'), + credential_scopes=resource_to_scopes(cli_ctx.cloud.endpoints.batch_resource_id))