Skip to content

[VM] Fix #33979: az vm user update: Fix password parsing so ')' in --password does not break Windows VM password reset - #33980

Open
Aditya Pujara (a0x1ab) wants to merge 8 commits into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
Open

[VM] Fix #33979: az vm user update: Fix password parsing so ')' in --password does not break Windows VM password reset#33980
Aditya Pujara (a0x1ab) wants to merge 8 commits into
Azure:devfrom
a0x1ab:agent-assist/azure-azure-cli-issue-33979-ef9e71dface1

Conversation

@a0x1ab

@a0x1ab Aditya Pujara (a0x1ab) commented Aug 25, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ️✔️ All clear

Breaking Changes Tests
️✔️ None ️✔️ 130/130

Description

Fixes #33979.

On Windows, az vm user update --password 'Test)123' fails with 123 was unexpected at this time. before Python starts. The ) in the password closes the IF EXIST (...) ... ELSE (...) parenthesis block in az.bat, breaking cmd.exe parsing.

Related command
az vm user update

Description

  • src/azure-cli/az.bat: Replace the IF EXIST (...) ELSE (...) block—which embeds %* inside parentheses—with a GOTO-based pattern so argument values containing ) (or other cmd.exe metacharacters) never terminate a grouping block:

    IF NOT EXIST "%~dp0\python.exe" GOTO usepath
    "%~dp0\python.exe" -m azure.cli %*
    GOTO end
    :usepath
    python -m azure.cli %*
    :end
  • test_custom_vm_commands.py: Add test_reset_windows_admin_special_chars_in_password — mocks VMExtensionCreate and asserts passwords containing ), (, &, |, and ^ reach protected_settings verbatim, confirming the Python-level extension call path does not corrupt special characters.

Testing Guide

On Windows with cmd.exe or PowerShell, the following should now succeed rather than erroring before any Azure API call:

az vm user update -g myRg -n myWinVm --username AzureUser --password "Test)123"

Unit test (offline, no Azure subscription needed):

python -m pytest azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password

History Notes

[VM] az vm user update: Fix ) and other shell metacharacters in --password breaking Windows VM password reset on cmd.exe

…' in --password does not break Windows VM password reset

* Initial plan

* [VM] az vm user update: fix ) in password breaking cmd.exe via az.bat GOTO refactor

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

PASS

Selectors: test_custom_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: bf5119ec1af711f0843a5b5ee8c6e74a154ecd59
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/32830818633

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13705: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_custom_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 8 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [ 25%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [ 37%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password PASSED [ 62%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [ 75%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [ 87%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 8 passed in 0.48s ===============================

Posted by agent-assist live-test workflow.

@x-engineering-agent x-engineering-agent Bot changed the title [VM] Fix #33979: az vm user update: Fix password parsing so ')' in --password does not break Windows VM password reset [VM] Fix #33979: az vm user update: Fix password parsing so ')' in --password does not break Windows VM password reset Aug 25, 2026
@yonzhan

Copy link
Copy Markdown
Collaborator

VM

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Upstream CI

All 64 checks passed; no failures to report.

Test validation

  • Live test: Passed (azdev test against the changed VM test file, live run).
  • Regression coverage: Not applicable — the production change is in src/azure-cli/az.bat, which is outside the azdev/module regression-coverage scope.

Review-skill findings

test-strength — src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py (new test test_reset_windows_admin_special_chars_in_password, lines 170-198)

The actual bug fix in this PR is entirely in src/azure-cli/az.bat: the previous IF EXIST (...) ELSE (...) block expanded %* inside a parenthesized block, so any argument containing ) (e.g. --password "Test)123") truncated/corrupted the batch script's command line before Python ever ran. The fix replaces the parenthesized IF/ELSE with a GOTO-based branch, which is the correct fix for this class of cmd.exe parsing bug.

However, the new test only exercises _reset_windows_admin in Python and asserts that protected_settings['Password'] is passed verbatim. That code path never went through az.bat and was not affected by the bug — this test would pass identically whether or not the az.bat fix is present or is reverted. It therefore provides no regression protection for the actual defect being fixed, and would not fail if the az.bat change were rolled back or broken again in the future.

Remediation: Since az.bat argument parsing can't be exercised through azdev/pytest, add a narrow platform-specific regression check instead (or explicitly note in the PR description why none is added), for example a Windows CI step that invokes az.bat --version (or a lightweight command) with a )-containing dummy argument via subprocess and asserts the process starts without a batch parsing error. Alternatively, at minimum call out in the PR description that the fix is verified manually on Windows, since the added Python unit test is not evidence the az.bat fix works or continues to work.

Verification: After adding a batch-level check, rerun it locally on Windows (cmd /c az.bat vm user update ... --password "Test)123") to confirm the script no longer breaks on ).

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, 41 changed lines (+36 / -5), 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.

@x-engineering-agent
x-engineering-agent Bot marked this pull request as ready for review August 26, 2026 04:51
@x-engineering-agent
x-engineering-agent Bot requested a review from a team as a code owner August 26, 2026 04:51
Copilot AI lite review requested due to automatic review settings August 26, 2026 04:51
@x-engineering-agent
x-engineering-agent Bot requested review from a team as code owners August 26, 2026 04:51
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

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.

Pull request overview

Fixes a Windows cmd.exe parsing failure where az vm user update --password "Test)123" could break inside az.bat before Python starts, by removing the parenthesized IF (...) ELSE (...) block that embedded %*.

Changes:

  • Update src/azure-cli/az.bat to use a GOTO-based flow so ) in arguments can’t terminate a parenthesized block during cmd.exe parsing.
  • Add a VM unit test that mocks VMExtensionCreate and verifies passwords containing ), (, &, |, and ^ are passed through to protected_settings unchanged.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py Adds a regression unit test asserting special-character passwords reach the Windows access extension call path verbatim.
src/azure-cli/az.bat Replaces the parenthesized IF/ELSE block with GOTO labels to avoid cmd.exe block-parsing issues with ) in %*.

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

@a0x1ab

Aditya Pujara (a0x1ab) commented Aug 28, 2026

Copy link
Copy Markdown
Member Author

@azure-client-tools-agent This is a correct fix but it needs a new live test to evalute the work. Also, it needs align the changes from this az.bat file with the other executable methods of az inclusive of https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/scripts/az_msi.cmd and https://github.com/Azure/azure-cli/blob/dev/build_scripts/windows/scripts/az_zip.cmd. Check historically, why was this issue not reported before if our file was incorrect all this time?

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

PASS

Selectors: test_custom_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: 37f20fd1ee3f9b2b8d70451beef13db6f0af625f
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33146918969

Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13705: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_custom_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 8 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [ 12%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [ 25%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [ 37%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [ 50%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password PASSED [ 62%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [ 75%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [ 87%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [100%]

- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
============================== 8 passed in 0.43s ===============================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Automated review summary

CI: ✅ All 50/50 checks passed (breaking-change test, full test suite).

Live test: ✅ Reused prior dispatch — azdev test run for the changed test file completed successfully.

Regression coverage: ✅ Not applicable / no gap — the change touches az.bat (batch launcher) and adds a corresponding unit test (test_reset_windows_admin_special_chars_in_password) in the same PR.

Scope: The diff is limited to src/azure-cli/az.bat (replacing the IF EXIST (...) ELSE (...) parenthesis block with a GOTO-based pattern so ) and other cmd.exe metacharacters in --password don't break argument parsing) and a new unit test validating that special-character passwords reach protected_settings verbatim. Both changes match the stated title/description and issue #33919 (az vm user update password parsing fix).

Review-skill findings: none confirmed.

No further action needed from automation; ready for human merge decision.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for human feedback at #33980 (comment): https://github.com/a0x1ab/azure-cli/tasks/d5757b04-f6d6-4ecb-a179-22732a3eb473

…and add special-password live test

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: 09ff8bac22a106b067d005a91b4fcf60709b04d7
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33346886229

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13726: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_custom_vm_commands, test_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 387 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [  2%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias FAILED [  2%]

=================================== FAILURES ===================================
_________ VMImageListByAliasesScenarioTest.test_vm_image_list_by_alias _________
self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
------------------------------ Captured log call -------------------------------
WARNING  cli.azure.cli.command_modules.vm.custom:custom.py:2736 You are viewing an offline list of images, use --all to retrieve an up-to-date list
- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
=========================== short test summary info ============================
FAILED azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias - self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed, 8 passed in 3.52s ==========================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Upstream CI

Azure.azure-cli Full Test

  • Result: failure
  • Relevance: Uncertain
  • Evidence: Build #20260831.1 had test failures
  • Suggested fix: Open the linked log and confirm whether the first actionable error touches the PR diff before changing code.
  • Verify: Re-run Azure.azure-cli Full Test and confirm it passes on the new head.

Nested failing jobs in the same build:

  • Automation Full Test Python312 Profile Latest instance2 — failure
  • Automation Full Test Python314 Profile Latest instance2 — failure

Test validation

  • Live test: Failed with conclusion failure. Workflow run
  • Regression coverage: Not applicable to the changed files.

No review-skill findings were confirmed for this change.

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: 5 changed files, 98 changed lines (+79 / -19), 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.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #33980 (review): https://github.com/a0x1ab/azure-cli/tasks/0e5cf2a6-ae3e-40c8-acad-3cb772563f28

…rding exists)

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: 195a9d5d40c47ec3e88aced857ed622c901c58f7
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33348914160

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13727: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_custom_vm_commands, test_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 387 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [  2%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias FAILED [  2%]

=================================== FAILURES ===================================
_________ VMImageListByAliasesScenarioTest.test_vm_image_list_by_alias _________
self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
------------------------------ Captured log call -------------------------------
WARNING  cli.azure.cli.command_modules.vm.custom:custom.py:2736 You are viewing an offline list of images, use --all to retrieve an up-to-date list
- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
=========================== short test summary info ============================
FAILED azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias - self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed, 8 passed in 3.74s ==========================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: 4e2e4b6d873893273b49a3ac0402c4182378504b
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33351093415

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
Last 80 lines of azdev output

=============
| Run Tests |
=============


=====================
| Discovering Tests |
=====================

/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:13727: SyntaxWarning: invalid escape sequence '\]'
  self.cmd('vmss application set -g {rg} -n {vmss} --app-version-ids {vid1} {vid2} --enable-automatic-upgrade True\]', checks=[
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:18: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_compute': '\{"providers":\["Microsoft.Compute"\]\}',
/home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli/azure/cli/command_modules/identity/tests/latest/test_identity.py:19: SyntaxWarning: invalid escape sequence '\{'
  'resource_restriction_empty': '\{"providers":\[\]\}'

test index updated: /home/runner/.azdev/env_config/home/runner/work/issue-sentinel/issue-sentinel/.venv/test_index/latest.json

Test on modules: test_custom_vm_commands, test_vm_commands

WARNING: RUNNING TESTS LIVE
The tests are set to run against current profile "latest"
============================= test session starts ==============================
platform linux -- Python 3.12.14, pytest-9.1.1, pluggy-1.6.0 -- /home/runner/work/issue-sentinel/issue-sentinel/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/issue-sentinel/issue-sentinel/azure-cli/src/azure-cli
plugins: forked-1.7.5, xdist-3.8.0
collecting ... collected 387 items

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_access_extension_upgrade_info PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_get_extension_instance_name_when_type_none PASSED [  0%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_merge_secrets PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVmCustom::test_reset_windows_admin_special_chars_in_password PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_handle_unicode PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_init_storage_sdk PASSED [  1%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py::TestVMBootLog::test_vm_boot_log_uses_keys_property PASSED [  2%]
azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias FAILED [  2%]

=================================== FAILURES ===================================
_________ VMImageListByAliasesScenarioTest.test_vm_image_list_by_alias _________
self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
------------------------------ Captured log call -------------------------------
WARNING  cli.azure.cli.command_modules.vm.custom:custom.py:2736 You are viewing an offline list of images, use --all to retrieve an up-to-date list
- generated xml file: /home/runner/work/issue-sentinel/issue-sentinel/test-output/results.xml -
=========================== short test summary info ============================
FAILED azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias - self = <latest.test_vm_commands.VMImageListByAliasesScenarioTest testMethod=test_vm_image_list_by_alias>

    def test_vm_image_list_by_alias(self):
        result = self.cmd('vm image list --offer ubuntu').get_output_in_json()
        self.assertTrue(len(result) >= 1)
        self.assertEqual(result[-1]['publisher'], 'Canonical')
>       self.assertTrue('lts' in result[-1]['sku'])
E       AssertionError: False is not true

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:58: AssertionError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
========================= 1 failed, 8 passed in 4.85s ==========================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Live test failure

The dispatched azdev test --live run (only the changed test files in this PR
were selected: test_custom_vm_commands.py, test_vm_commands.py) reported
1 failed, 8 passed:

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py::VMImageListByAliasesScenarioTest::test_vm_image_list_by_alias FAILED

    self.assertTrue(len(result) >= 1)
    self.assertEqual(result[-1]['publisher'], 'Canonical')
>   self.assertTrue('lts' in result[-1]['sku'])
E   AssertionError: False is not true

This failing test (test_vm_image_list_by_alias) is a pre-existing scenario
test in test_vm_commands.py — it is unrelated to the new
test_vm_user_update_win_special_password regression test or the
_reset_windows_admin fix added by this PR. It exercises az vm image list-by-aliases and asserts the latest Canonical Ubuntu image SKU contains
'lts'; live Azure image publisher data may have changed the SKU naming
convention since the assertion was written, causing an environment/data drift
failure rather than a regression introduced here.

Next action: confirm whether test_vm_image_list_by_alias still reflects
the current Canonical Ubuntu SKU naming (query az vm image list --publisher Canonical --sku "*" --all --output table or the equivalent image list-by-
aliases output) and update the assertion if the naming convention changed.
If the assertion is confirmed stale/unrelated, update or relax it so it no
longer blocks this PR; otherwise investigate why the alias lookup no longer
returns an lts SKU. Re-run only the changed-file live test after the fix:
azdev test test_custom_vm_commands test_vm_commands --live.

Test validation

  • Live test: Failed with conclusion failure. Workflow run
  • Regression coverage: Not applicable to the changed files.

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: 5 changed files, 99 changed lines (+80 / -19), 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.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #33980 (review): https://github.com/a0x1ab/azure-cli/tasks/e87ed520-b361-4743-81a8-2495b1ef3fc2

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: c59cd5b21575ab90722226f78ba188d0681196c9
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33353433331

Live-test recordings: 3 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias_and_filtered_by_arch.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_reimage.yaml
Last 80 lines of azdev output
During handling of the above exception, another exception occurred:

self = <latest.test_vm_commands.VmReimageTest testMethod=test_vm_reimage>
resource_group = 'cli_test_vm_reimage_sbkoezekaseisr4wqwkjlxoux36u7kprktyr2wlhem4izytac4v4lts'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_vm_reimage_')
    def test_vm_reimage(self, resource_group):
    
        self.kwargs.update({
            'vm': 'vm',
            'subnet': 'mysubnet',
            'vnet': 'myvnet',
            'pubip': 'pubip',
        })
    
        # Create a public IP resource with service tag
>       self.cmd('network public-ip create --name {pubip} -g {rg} --ip-tags FirstPartyUsage=/NonProd')

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:797: in _run_job
    result = transform_op(result)
             ^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/_format.py:93: in transform_public_ip_create_output
    return {'publicIp': result.result()}
                        ^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:105: in result
    self.wait(timeout)
.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:127: in wait
    raise self._exception
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:80: in _start
    for polling_method in self._polling_generator:
                          ^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:507: in _execute_operations
    yield self.PublicIpAddressOperationGroupCreateOrUpdate(ctx=self.ctx)()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:547: in __call__
    return self.on_error(session.http_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.command_modules.network.aaz.latest.network.public_ip._create.Create.PublicIpAddressOperationGroupCreateOrUpdate object at 0x7f3472eed580>
response = <RequestsTransportResponse: 400 Bad Request, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
            raise error_type(response=response)
        # raise HttpResponseError
        error_format = self.ctx.get_error_format(self.error_format)
>       raise HttpResponseError(response=response, error_format=error_format)
E       azure.core.exceptions.HttpResponseError: (SubscriptionNotRegisteredForFeature) Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.
E       Code: SubscriptionNotRegisteredForFeature
E       Message: Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.

azure-cli/src/azure-cli-core/azure/cli/core/aaz/_operation.py:327: HttpResponseError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
======================== 1 failed, 10 passed in 15.94s =========================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: 7afb310cdf0662e3395d2177d0ddb73aa56cac00
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33355571170

Live-test recordings: 3 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias_and_filtered_by_arch.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_reimage.yaml
Last 80 lines of azdev output
During handling of the above exception, another exception occurred:

self = <latest.test_vm_commands.VmReimageTest testMethod=test_vm_reimage>
resource_group = 'cli_test_vm_reimage_z5paqwbl67dufygs2cplijmrppcid7oseayi6x3u7wfal2uef2a6hlv'

    @AllowLargeResponse()
    @ResourceGroupPreparer(name_prefix='cli_test_vm_reimage_')
    def test_vm_reimage(self, resource_group):
    
        self.kwargs.update({
            'vm': 'vm',
            'subnet': 'mysubnet',
            'vnet': 'myvnet',
            'pubip': 'pubip',
        })
    
        # Create a public IP resource with service tag
>       self.cmd('network public-ip create --name {pubip} -g {rg} --ip-tags FirstPartyUsage=/NonProd')

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:797: in _run_job
    result = transform_op(result)
             ^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/_format.py:93: in transform_public_ip_create_output
    return {'publicIp': result.result()}
                        ^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:105: in result
    self.wait(timeout)
.venv/lib/python3.12/site-packages/azure/core/tracing/decorator.py:119: in wrapper_use_tracer
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:127: in wait
    raise self._exception
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_poller.py:80: in _start
    for polling_method in self._polling_generator:
                          ^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:507: in _execute_operations
    yield self.PublicIpAddressOperationGroupCreateOrUpdate(ctx=self.ctx)()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/network/aaz/latest/network/public_ip/_create.py:547: in __call__
    return self.on_error(session.http_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.command_modules.network.aaz.latest.network.public_ip._create.Create.PublicIpAddressOperationGroupCreateOrUpdate object at 0x7f176dd4e780>
response = <RequestsTransportResponse: 400 Bad Request, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
            raise error_type(response=response)
        # raise HttpResponseError
        error_format = self.ctx.get_error_format(self.error_format)
>       raise HttpResponseError(response=response, error_format=error_format)
E       azure.core.exceptions.HttpResponseError: (SubscriptionNotRegisteredForFeature) Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.
E       Code: SubscriptionNotRegisteredForFeature
E       Message: Subscription /subscriptions/f758ac53-3e63-4317-a956-0997793808d7/resourceGroups//providers/Microsoft.Network/subscriptions/ is not registered for feature Microsoft.Network/AllowBringYourOwnPublicIpAddress required to carry out the requested operation.

azure-cli/src/azure-cli-core/azure/cli/core/aaz/_operation.py:327: HttpResponseError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
======================== 1 failed, 10 passed in 15.95s =========================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Upstream CI

All required Azure DevOps checks passed (50/50 completed, 0 failed).

Test validation

  • Live test: azdev test test_custom_vm_commands test_vm_commands --live --series FAILED — run https://github.com/Azure/issue-sentinel/actions/runs/33355571170.
    • Only 11 of the selected tests ran before the suite aborted: pytest is configured with maxfail=1, and the very first failure — VmReimageTest::test_vm_reimage — stopped the run before it ever reached the new regression test this PR added, VmUserUpdateWinScenarioTest::test_vm_user_update_win_special_password (defined immediately after the existing test_vm_user_update_win in test_vm_commands.py).
    • test_vm_reimage's failure is an environment/subscription issue unrelated to this PR's change: network public-ip create --ip-tags FirstPartyUsage=/NonProd fails with SubscriptionNotRegisteredForFeature: ... Microsoft.Network/AllowBringYourOwnPublicIpAddress. This test isn't touched by the diff, and the same test file already skips a different test with @unittest.skip('SubscriptionNotRegisteredForFeature'), confirming this subscription-feature gap is a known, pre-existing environment limitation rather than something introduced here.
    • Net effect: the actual regression test for this fix (test_vm_user_update_win_special_password) has not yet been verified to pass, because the unrelated failure short-circuited the run.
  • Regression coverage: Not applicable — no command_modules production files were changed (only Windows launcher scripts az.bat, az_msi.cmd, az_zip.cmd, and the two VM test files).

Please make the new regression test (test_vm_user_update_win_special_password) actually execute and pass. For example, mark or reorder so VmReimageTest::test_vm_reimage (an unrelated, already-known-flaky live test) does not abort the run under maxfail=1 before the new test runs — e.g. by skipping/deprioritizing the reimage test locally, or re-dispatching test selection so only the new test class runs. Confirm the new test passes live before requesting review again.

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: 5 changed files, 111 changed lines (+87 / -24), 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.

@x-engineering-agent

Copy link
Copy Markdown
Contributor

Started a Copilot task using claude-sonnet-4.6 for the automated review at #33980 (review): https://github.com/a0x1ab/azure-cli/tasks/65bb7077-0514-4bce-9d81-5892472fdb71

Co-authored-by: a0x1ab <59631311+a0x1ab@users.noreply.github.com>
@x-engineering-agent

Copy link
Copy Markdown
Contributor

Live test results — azdev test --live --series (changed test files only)

FAIL (exit 1)

Selectors: test_custom_vm_commands test_vm_commands (module)
PR head ref: agent-assist/azure-azure-cli-issue-33979-ef9e71dface1
PR head sha: b737b2e6038e09c75982475b026c1fad8cebc041
PR base ref: dev
New test files in PR: false

Changed test files run
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_custom_vm_commands.py
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py

Workflow run: https://github.com/Azure/issue-sentinel/actions/runs/33358810601

Live-test recordings: 4 regenerated — archived in workflow artifact live-test-pr-33980 (recordings/).

ℹ️ This PR is from a fork, so recordings were not pushed automatically. Download them from the artifact and commit to your branch.

Recording files
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_by_alias_and_filtered_by_arch.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_image_list_thru_services_deprecation_status.yaml
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_usage.yaml
Last 80 lines of azdev output

azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/patches.py:35: CliExecutionError

During handling of the above exception, another exception occurred:

self = <latest.test_vm_commands.VMImageListThruServiceScenarioTest testMethod=test_vm_image_list_thru_services_deprecation_status>

    @AllowLargeResponse()
    def test_vm_image_list_thru_services_deprecation_status(self):
        self.cmd('vm image list --offer CentOs --publisher OpenLogic --sku 7.7 --architecture x64 --all ', checks=[
            self.check('[0].imageDeprecationStatus.imageState', 'Active'),
            self.check('[0].imageDeprecationStatus.scheduledDeprecationTime', None),
        ])
>       self.cmd('vm image list --offer CentOs --publisher OpenLogic --sku 7.7 --architecture x64 --edge-zone losangeles', checks=[
            self.check('[0].imageDeprecationStatus.imageState', 'Active'),
            self.check('[0].imageDeprecationStatus.scheduledDeprecationTime', None)
        ])

azure-cli/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py:149: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:177: in cmd
    return execute(self.cli_ctx, command, expect_failure=expect_failure).assert_with_checks(checks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:252: in __init__
    self._in_process_execute(cli_ctx, command, expect_failure=expect_failure)
azure-cli/src/azure-cli-testsdk/azure/cli/testsdk/base.py:315: in _in_process_execute
    raise ex.exception
.venv/lib/python3.12/site-packages/knack/cli.py:233: in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:677: in execute
    raise ex
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:820: in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:789: in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/__init__.py:335: in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli-core/azure/cli/core/commands/command_operation.py:120: in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/vm/custom.py:2732: in list_vm_images
    all_images = load_images_thru_services(cmd.cli_ctx, publisher_name, offer, sku, image_location, edge_zone,
azure-cli/src/azure-cli/azure/cli/command_modules/vm/_actions.py:155: in load_images_thru_services
    publishers = VMImageEdgeZoneListPublishers(cli_ctx=cli_ctx)(command_args={
azure-cli/src/azure-cli-core/azure/cli/core/aaz/_command.py:154: in __call__
    return self._handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
azure-cli/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/image/edge_zone/_list_publishers.py:27: in _handler
    self._execute_operations()
azure-cli/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/image/edge_zone/_list_publishers.py:55: in _execute_operations
    self.VirtualMachineImagesEdgeZoneListPublishers(ctx=self.ctx)()
azure-cli/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/image/edge_zone/_list_publishers.py:79: in __call__
    return self.on_error(session.http_response)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <azure.cli.command_modules.vm.aaz.latest.vm.image.edge_zone._list_publishers.ListPublishers.VirtualMachineImagesEdgeZoneListPublishers object at 0x7fe93486d940>
response = <RequestsTransportResponse: 400 Bad Request, Content-Type: application/json; charset=utf-8>

    def on_error(self, response):
        """ handle errors in response
        """
        # raise common http errors
        error_type = self.error_map.get(response.status_code)
        if error_type:
            raise error_type(response=response)
        # raise HttpResponseError
        error_format = self.ctx.get_error_format(self.error_format)
>       raise HttpResponseError(response=response, error_format=error_format)
E       azure.core.exceptions.HttpResponseError: (UnsupportedEdgeZone) Edge zone 'losangeles' not found. The available edge zones in location 'westus' are ''.
E       Code: UnsupportedEdgeZone
E       Message: Edge zone 'losangeles' not found. The available edge zones in location 'westus' are ''.

azure-cli/src/azure-cli-core/azure/cli/core/aaz/_operation.py:327: HttpResponseError
!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!
=================== 1 failed, 11 passed, 1 skipped in 11.73s ===================

Posted by the Azure Client Tools Agent live-test workflow.

@x-engineering-agent x-engineering-agent Bot 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.

Aditya Pujara (@a0x1ab)

Handoff summary

Automated Copilot fixing gave up after 3 attempts (agent_review cycle); leaving this PR for human review.

Upstream CI

All 50 required checks passed at head b737b2e6038e09c75982475b026c1fad8cebc041 (0 failed, 0 pending).

Test validation

  • Live test (azdev test --live --series, changed test files only) FAILED: test_vm_image_list_thru_services_deprecation_status raised azure.core.exceptions.HttpResponseError: (UnsupportedEdgeZone) Edge zone 'losangeles' not found. The available edge zones in location 'westus' are ''. This test exercises vm image list --edge-zone losangeles, which is unrelated to this PR's actual change (Windows launcher-script )-in-password parsing fix for az vm user update). The failure looks like a test-environment/subscription capability limitation (the losangeles edge zone is not provisioned in the live-test subscription/region), not a regression introduced by this PR's diff.
  • Regression coverage: no gap — this PR adds a unit test (test_reset_windows_admin_special_chars_in_password) and a @live_only() scenario test (test_vm_user_update_win_special_password) directly covering the fix, and already skips the known-flaky test_vm_reimage case from an earlier iteration.

Next action

  1. A maintainer should re-run the live-test workflow (live-test.yml) once, since test_vm_image_list_thru_services_deprecation_status is unrelated to the code under test — if it passes with a fresh subscription/edge-zone allocation, this confirms the earlier result was environmental flake.
  2. If it fails again, verify losangeles edge-zone availability for the live-test subscription in westus; this is a test-infrastructure issue, not something this PR's az.bat/az_msi.cmd/az_zip.cmd changes should touch.
  3. No further source change is requested for the reported failure; this is a non-blocking, unrelated test-infrastructure issue.

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: 5 changed files, 112 changed lines (+88 / -24), 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.

@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

🔔 Routing this PR to @Azure/act-observability-squad.

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

Labels

act-observability-squad Auto-Assign Auto assign by bot Compute az vm/vmss/image/disk/snapshot X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az vm user update fails to reset Windows VM password when password contains ')' character

5 participants