[ACR] Surface x-ms-warning header on PE connection delete - #33724
[ACR] Surface x-ms-warning header on PE connection delete#33724yushuliang0214 wants to merge 6 commits into
Conversation
Display server-side warning message (from x-ms-warning response header) when deleting a private endpoint connection that does not exist (204).
|
Validation for Azure CLI Full Test Starting...
Thanks for your contribution! |
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR updates the ACR command module to surface server-side warnings returned via the x-ms-warning response header when deleting an ACR private endpoint connection (notably on 204 responses).
Changes:
- Adds a module logger to
private_endpoint_connection.py. - Reads the
x-ms-warningheader from the initial delete LRO response and emits it vialogger.warning().
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Surface server-side warning (e.g. PE connection not found, returned 204) | ||
| initial_response = poller.polling_method()._initial_response | ||
| warning = initial_response.http_response.headers.get("x-ms-warning") | ||
| if warning: | ||
| logger.warning(warning) |
| # Surface server-side warning (e.g. PE connection not found, returned 204) | ||
| initial_response = poller.polling_method()._initial_response | ||
| warning = initial_response.http_response.headers.get("x-ms-warning") |
|
acr |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Pan-Qi
left a comment
There was a problem hiding this comment.
Please resolve failed test
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Hi Qi, I've resolved the failed tests, could you please review again? |
@microsoft-github-policy-service agree company="Microsoft" |
🤖 PR Validation — ️✔️ All clear
Description
When a private endpoint connection delete returns 204 (resource not found), the ACR server now sends an
x-ms-warningresponse header. This change reads that header from the initial LRO response and displays it to the user vialogger.warning().Changes
src/azure-cli/azure/cli/command_modules/acr/private_endpoint_connection.py: Readx-ms-warningheader from the delete LRO initial response and display it to the CLI user.Testing
Tested with
az acr private-endpoint-connection delete -r myRegistry -n nonExistentPE— warning message from server is displayed when PE does not exist (204 response).