Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{App Service} Call get_token() with scopes #30797

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3446,9 +3446,11 @@ def _get_site_credential(cli_ctx, resource_group_name, name, slot=None):

def get_bearer_token(cli_ctx):
from azure.cli.core._profile import Profile
from azure.cli.core.auth.util import resource_to_scopes
profile = Profile(cli_ctx=cli_ctx)
credential, _, _ = profile.get_login_credentials()
bearer_token = credential.get_token().token
scopes = resource_to_scopes(cli_ctx.cloud.endpoints.active_directory_resource_id)
bearer_token = credential.get_token(*scopes).token
return bearer_token


Expand Down