feat(acr): surface x-ms-warning header on PE connection delete#33724
feat(acr): surface x-ms-warning header on PE connection delete#33724yushuliang0214 wants to merge 1 commit 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 |
|
@yushuliang0214 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
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).