[Core] Update global policy argument --acquire-policy-token to pick up new api-version and propagate correlation-id#33661
Conversation
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Hi @Celinadhh, |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
@notyashhh PTAL, thank you! :) |
There was a problem hiding this comment.
Pull request overview
This PR updates the internal acquirePolicyToken request made when users opt into the global --acquire-policy-token behavior, aligning it with a newer ARM API version and ensuring correlation ID continuity to simplify end-to-end debugging.
Changes:
- Bump
acquirePolicyTokenapi-versionfrom2025-03-01to2025-11-01. - Reuse (or generate and set)
x-ms-correlation-request-idso theacquirePolicyTokencall shares the same correlation ID as the gated operation.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| correlation_id = http_request.headers.get('x-ms-correlation-request-id') | ||
| if not correlation_id: | ||
| correlation_id = str(uuid.uuid4()) | ||
| http_request.headers['x-ms-correlation-request-id'] = correlation_id |
There was a problem hiding this comment.
Wondering why you add the new correlation id to the incoming header when one isn't there. Is it used in creating the token (or for something else)?
There was a problem hiding this comment.
http_request is the original request (e.g. a storage account delete). If there is no existing correlation-id, we generate the correlation-id in the acquire-policy-token call, and propagate the same one to http_request (storage account delete).
|
Core |




Related command
All cli commands where users set
--acquire-policy-tokenDescription
This PR adds a few optimizations and updates to #31741. We are updating the api-version used for the acquire-policy-token calls so more information is outputted to the user. And also making sure the acquire-policy-token call uses the same correlation-id as its outgoing calls for easier debugging.
Testing Guide
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.