Repository navigation
[Core] Update global policy argument --acquire-policy-token to pick up new api-version and update error message - #34526
Open
ccz77 (Celinadhh) wants to merge 1 commit into
Open
ccz77 (Celinadhh) wants to merge 1 commit into
ccz77 (Celinadhh) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The URL and tests use api-version=2026-07-01 while the testing guide specifies 2025-07-01, leaving the intended service version unresolved.
1 open issue
What changed in this PR
Updates Azure CLI’s shared --acquire-policy-token hook to support resource-group-scoped acquisition and clearer policy-denial errors.
Changes:
- Derives acquisition scope from the outgoing request and changes the API version.
- Clarifies errors when the response contains no token.
- Adds unit tests for scope selection, token handling, and error behavior.
| File | Description |
|---|---|
| src/azure-cli-core/azure/cli/core/tests/test_sdk_policies.py | Adds policy-token hook coverage. |
| src/azure-cli-core/azure/cli/core/sdk/policies.py | Updates acquisition scope, API version, and denial messages. |
Review effort: Balanced
Member
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤖 PR Validation — ️✔️ All clear
Related command
All cli commands where users set
--acquire-policy-tokenDescription
This PR adds a few optimizations and updates to #33661. We are updating the api-version used for the acquire-policy-token calls so we can now support RG scope acquisition. And also updating the error message when no policy token is returned to be more user friendly.
Testing Guide
Apply an invoke policy on your resource.
Delete your resource directly - failure expected.
Delete your resource with --acquire-policy-token, expect call to acquire-policy-token API with 2026-07-01 api-version that uses same resource group as resource delete.
This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.