[VM] Fix #34083: az vm create: Preserve deployment errors when response content is consumed - #34102
Conversation
… response content is consumed AI-generated by X Engineering Agent via Azure AI Foundry. Foundry-Job: 1db2cabf7ddac34b0dfa941480fa60a4fcdefa80d11ad8ef5b07539efede9034
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Two moderate findings and one test setup nit remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Fixes az vm create deployment error handling when response content has already been consumed.
Changes:
- Preserves parsed or cached deployment error details.
- Adds regression coverage for consumed and malformed responses.
| File | Summary |
|---|---|
src/azure-cli-core/azure/cli/core/commands/arm.py |
Updates deployment exception formatting; two moderate findings remain regarding nested errors and broad RuntimeError handling. |
src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py |
Adds regression coverage; one test setup nit remains regarding response caching. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| error = getattr(ex, 'error', None) | ||
| # Retain parsed details if the body is consumed, but preserve a readable body in full: | ||
| # ODataV4Format omits ARM-specific fields such as additionalInfo. | ||
| error_message = str(error) if isinstance(error, ODataV4Format) else None |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Live test skipped⏭️ Skipping the live test for this revision because the only test file(s) changed are These |
There was a problem hiding this comment.
Review of deployment-error preservation
No confirmed changed-line defect was found at bbd7d8781673517fd080f12c409aaa0fe716dbb3. This is a non-approval review.
Scope and evidence
- Reviewed the shared production handler in
src/azure-cli-core/azure/cli/core/commands/arm.py:107-137and all 422 added lines insrc/azure-cli-core/azure/cli/core/commands/tests/test_arm.py, alongside VM/VMSS/availability-set registration, CLI polling/error propagation, and the pinned Azure Core 1.39.0 response/error implementations. - Traced readable-body retention (including ARM
additionalInfo), parsed/cached fallbacks for consumed streams, nested diagnostics,InvalidTemplateDeploymentclassification, missing/falsey responses, and optional body-read failures. The retained legacy branch handles SDKerror=throughinner_exception; no regression in that branch was established. The added assertions include SDK polling through the CLI, but were not executed in this review. - All seven skills accounted for: release wording matches the fix; generated ownership and command/help have no relevant edits; test strength, scope consistency, and changed core domain behavior were inspected; no parameter/token mapping change affects user intent. Deterministic findings: 0; confirmed semantic findings: 0.
Upstream CI
The coordinator's head-matched snapshot reports 53/53 checks completed successfully, with no failed, cancelled, or pending checks. CI was not re-polled. No local tests, builds, PR code, or live-test dispatch were run in this review.
Test validation
- Live test: Skipped: no runnable changed test files were found.
- Regression coverage: Not applicable to the changed files.
The reused live result was neutral, skipped because the changed runnable test coverage consists of azure-cli-core unit tests, which are not runnable by azdev --live. This is not a passed live test.
Coverage limits
The focused regression file is src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py. No recording changes or live-service validation accompanied the changed error presentation; the inspected coverage is offline core regression coverage, not proof of complete integration coverage. Rerun this focused suite after any revisions before merge.
The deterministic coverage/risk heuristics are command-module-oriented and do not count this shared core production file. Their not-applicable/zero-production signals below do not mean this is a test-only PR.
Risk assessment
0/100 · Low · Low confidence
The Low rating reflects the detected change scope with no elevated security, reliability, customer, operational, dependency, sovereign-cloud, generated-output, or cross-component signal.
- Change scope: 2 changed files, 457 changed lines (
+451/-6), including 0 production files. - Affected components: No production component was identified.
- Risk drivers: No elevated risk signal was detected.
- Regression evidence: No production-code regression-test signal applies.
- Confidence: Low because no production changed-line evidence was available.
- Required review: No additional owning-squad review signal was detected.
|
VM |

🤖 PR Validation — ️✔️ All clear
Related command
az vm createDescription
Fixes #34083.
Implemented by X Engineering Agent using Azure AI Foundry. This is an AI-generated change, published by the configured operator.
Testing Guide
az vm create.src/azure-cli-core/azure/cli/core/commands/tests/test_arm.py.History Notes
[VM]
az vm create: Preserve deployment errors when response content is consumedThis 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.