Skip to content

[App Service] az webapp deploy: Change get_bearer_token to use App Service Audience#31988

Merged
zhoxing-ms merged 3 commits intoAzure:devfrom
dannysongg:use-appservice-audience
Sep 30, 2025
Merged

[App Service] az webapp deploy: Change get_bearer_token to use App Service Audience#31988
zhoxing-ms merged 3 commits intoAzure:devfrom
dannysongg:use-appservice-audience

Conversation

@dannysongg
Copy link
Copy Markdown
Member

@dannysongg dannysongg commented Aug 22, 2025

Related command
az webapp deploy

Description
Adding app_service_resource_id to the cloud config. Public cloud is mapped to the App service audience (https://appservice.azure.com). MC and FF are be mapped to the existing ARM audience (https://management.core.windows.net/) until token acquisition is fully supported by the App Service audience in those regional clouds. It will be switched to https://appservice.azure.com once supported.

get_bearer_token() will begin using the App Service audience (https://appservice.azure.com) instead of ARM (https://management.core.windows.net/) to communicate with the SCM site for security hygiene.

Testing Guide
Tested az webapp deploy --resource-group {rg-name} --name {app-name} --src-path {artifact-path} --debug to ensure that https://appservice.azure.com is being used to fetch the bearer token.
image

History Notes

[App Service] az webapp deploy: Change the token retrieval function to use the App Service Audience


This checklist is used to make sure that common guidelines for a pull request are followed.

Copilot AI review requested due to automatic review settings August 22, 2025 19:20
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Aug 22, 2025

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @dannysongg,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Aug 22, 2025

️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Aug 22, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the az webapp deploy command to use App Service-specific audience for authentication instead of the broader ARM audience, improving security hygiene by scoping down token permissions.

Key Changes:

  • Modified get_bearer_token() function to use app_service_resource_id instead of active_directory_resource_id
  • Added app_service_resource_id endpoint to the cloud configuration for all Azure cloud environments
  • Updated cloud endpoint mappings to support the new App Service resource ID

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/azure-cli/azure/cli/command_modules/appservice/custom.py Updated token acquisition to use App Service audience
src/azure-cli-core/azure/cli/core/cloud.py Added App Service resource ID endpoints for all cloud environments

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/azure-cli-core/azure/cli/core/cloud.py
@dannysongg dannysongg force-pushed the use-appservice-audience branch from 61adaf8 to e21d8d2 Compare August 22, 2025 19:58
Copy link
Copy Markdown

@jvano jvano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yanzhudd
Copy link
Copy Markdown
Contributor

please add some tests for the change to ensure it works well.

@yanzhudd
Copy link
Copy Markdown
Contributor

Please note that the Azure CLI release process will begin on 09/30/2025 at 07:00 UTC. If this PR is intended for the upcoming release, kindly resolve the comments as soon as possible, otherwise it will need to be postponed to the next sprint.

@dannysongg
Copy link
Copy Markdown
Member Author

@yanzhudd This change does not touch the functionality of the command. It only changes the token audience that is used for authentication. The existing test will still cover this change, as it will be using the new token audience.

@yanzhudd
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd
Copy link
Copy Markdown
Contributor

Hi @dannysongg
Since the get_bearer_token function is an internal implementation detail that isn’t visible to users, it’s better to use clearer language in the release notes. I’ve revised it accordingly:
image
Please let me know if you have any suggestions about it.

@dannysongg
Copy link
Copy Markdown
Member Author

@yanzhudd the new release note looks good to me

@zhoxing-ms zhoxing-ms merged commit eecf802 into Azure:dev Sep 30, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Auto-Assign Auto assign by bot Web Apps az webapp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants