Skip to content

Commit f14133a

Browse files
committed
batch-credential-scopes
1 parent 5814523 commit f14133a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/azure-cli/azure/cli/command_modules/batch/_client_factory.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ def batch_data_client_factory(cli_ctx, kwargs):
5050

5151
if not token_credential and not account_key:
5252
from azure.cli.core._profile import Profile
53+
from azure.cli.core.auth.util import resource_to_scopes
5354
profile = Profile(cli_ctx=cli_ctx)
54-
resource = cli_ctx.cloud.endpoints.batch_resource_id
55-
token_credential, _, _ = profile.get_login_credentials(resource=resource)
55+
token_credential, _, _ = profile.get_login_credentials()
5656

5757
if account_key:
5858
from azure.core.credentials import AzureNamedKeyCredential
@@ -64,4 +64,5 @@ def batch_data_client_factory(cli_ctx, kwargs):
6464
account_endpoint.startswith('http://')):
6565
account_endpoint = 'https://' + account_endpoint
6666

67-
return BatchClient(credential=credential, endpoint=account_endpoint.rstrip('/'))
67+
return BatchClient(credential=credential, endpoint=account_endpoint.rstrip('/'),
68+
credential_scopes=resource_to_scopes(cli_ctx.cloud.endpoints.batch_resource_id))

src/azure-cli/azure/cli/command_modules/batch/_validators.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,7 @@ def validate_client_parameters(cmd, namespace):
332332
# check to see if we are using the default credentials
333333
from azure.cli.core._profile import Profile
334334
profile = Profile(cli_ctx=cmd.cli_ctx)
335-
resource = cmd.cli_ctx.cloud.endpoints.batch_resource_id
336-
token_credential, _, _ = profile.get_login_credentials(resource=resource)
335+
token_credential, _, _ = profile.get_login_credentials()
337336

338337
# if not we query for the account key
339338
if token_credential is None:

0 commit comments

Comments
 (0)