Skip to content

Commit

Permalink
batch-credential-scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
jiasli committed Feb 7, 2025
1 parent 5814523 commit e3edb2a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))

0 comments on commit e3edb2a

Please sign in to comment.