Skip to content

[ACR] az acr scope-map delete: Fix missing service warnings - #34167

Open
SakoPak (SakoPak) wants to merge 4 commits into
Azure:devfrom
SakoPak:sako/improve-scopemap-delete
Open

SakoPak (SakoPak) wants to merge 4 commits into
Azure:devfrom
SakoPak:sako/improve-scopemap-delete

Conversation

@SakoPak

@SakoPak SakoPak (SakoPak) commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Related command
az acr scope-map delete

Description
When a scope map deletion completes with a service warning, Azure CLI currently exposes the x-ms-warning response header only in debug logs. Users running az acr scope-map delete normally do not see which associated tokens require follow-up action.

This PR registers an Azure SDK response hook for the asynchronous delete operation and emits each distinct service warning once through the standard CLI warning channel. Behavior remains unchanged when the service does not return x-ms-warning.

This change works in tandem with the active ACR backend implementation:
https://msazure.visualstudio.com/One/_git/DevServices-ContainerRegistry-Service/pullrequest/16790540

Repair item:
https://msazure.visualstudio.com/AzureContainerRegistry/_workitems/edit/33216671

Testing Guide

  1. Run the ACR mock command tests: python -m unittest azure.cli.command_modules.acr.tests.latest.test_acr_commands_mock.AcrMockCommandsTests.
  2. Verify a response without x-ms-warning does not emit a warning.
  3. Verify repeated polling responses containing the same x-ms-warning emit the warning once.
  4. After backend PR 16790540 is deployed, delete a scope map associated with a token missing its authorization entity and verify the token-specific warning is displayed without --debug.

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

@SakoPak
SakoPak (SakoPak) requested a review from a team as a code owner October 5, 2026 17:56
@SakoPak SakoPak (SakoPak) changed the title {ACR} Surface scope map delete warnings [ACR] az acr scope-map delete: Surface service warnings during deletion Oct 5, 2026
@SakoPak SakoPak (SakoPak) changed the title [ACR] az acr scope-map delete: Surface service warnings during deletion [ACR] az acr scope-map delete: Fix missing service warnings Oct 5, 2026
@SakoPak
SakoPak (SakoPak) changed the base branch from main to dev October 5, 2026 18:46
@yonzhan

Copy link
Copy Markdown
Collaborator

ACR

Copilot AI balanced review requested due to automatic review settings October 6, 2026 04:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation is focused, correctly handles LRO responses, and includes appropriate regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds user-visible, deduplicated service warnings for az acr scope-map delete.

Changes:

  • Adds an SDK response hook for x-ms-warning.
  • Emits each distinct warning once.
  • Adds focused tests for absent and repeated warnings.
File Description
acr/​_utils.py Adds the warning response hook.
acr/​scope_map.py Attaches the hook to scope-map deletion.
acr/​tests/​latest/​test_acr_commands_mock.py Tests hook registration and deduplication.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants