Skip to content

{Compute} az vm/vmss create: Add SpotPlus option in --priority - #34030

Merged
Julie Zhu (yanzhudd) merged 4 commits into
Azure:devfrom
william051200:priority-spotplus
Sep 4, 2026
Merged

{Compute} az vm/vmss create: Add SpotPlus option in --priority#34030
Julie Zhu (yanzhudd) merged 4 commits into
Azure:devfrom
william051200:priority-spotplus

Conversation

@william051200

@william051200 William (william051200) commented Sep 4, 2026

Copy link
Copy Markdown
Member

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes Tests
⚠️ None ️✔️ 130/130
⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1010 - ParaPropUpdate vm create cmd vm create update parameter priority: updated property choices from ['Low', 'Regular', 'Spot'] to ['Low', 'Regular', 'Spot', 'SpotPlus']
⚠️ 1010 - ParaPropUpdate vm update cmd vm update update parameter priority: updated property choices from ['Low', 'Regular', 'Spot'] to ['Low', 'Regular', 'Spot', 'SpotPlus']
⚠️ 1010 - ParaPropUpdate vmss create cmd vmss create update parameter priority: updated property choices from ['Low', 'Regular', 'Spot'] to ['Low', 'Regular', 'Spot', 'SpotPlus']
⚠️ 1010 - ParaPropUpdate vmss update cmd vmss update update parameter priority: updated property choices from ['Low', 'Regular', 'Spot'] to ['Low', 'Regular', 'Spot', 'SpotPlus']

Related command

az vm create
az vmss create

Description

Resolve #33881

Testing Guide

Refer to azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py: test_vm_vmss_create_with_spot_plus_priority

History Notes

[Compute] az vm/vmss create: Add SpotPlus option in --priority parameter


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

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.

🟢 Approval recommended

The change is localized (enum/help + scenario test + recording) and the end-to-end test verifies SpotPlus is sent through correctly.

Pull request overview

Adds CLI support and scenario coverage for the new SpotPlus value on --priority for az vm create and az vmss create, aligning with the Compute RP’s new priority option and validating it end-to-end via recorded live tests.

Changes:

  • Extend --priority enum to include SpotPlus and update command help text.
  • Add a new scenario test covering VM create + Uniform/Flexible VMSS create using --priority SpotPlus with eviction policy and max price.
  • Add the corresponding test recording for playback.
File summaries
File Description
src/azure-cli/azure/cli/command_modules/vm/_params.py Adds SpotPlus to the Priority enum and updates help text for vm/vmss create.
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py Introduces a new scenario test validating SpotPlus behavior for VM + VMSS create flows.
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_vmss_create_with_spot_plus_priority.yaml Recorded HTTP interactions for the new SpotPlus scenario test.
Review details

Suppressed comments (1)

src/azure-cli/azure/cli/command_modules/vm/_params.py:1441

  • Same grammar issue in the vmss create-specific help text: "Default to Regular." should be "Defaults to Regular."
        c.argument('priority', arg_type=get_enum_type(Priority, default=None),
                   help="Priority. Use 'Spot' or 'SpotPlus' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' or 'SpotPlus' to deploy Azure spot VM and/or VMSS. Default to Regular.")
  • Files reviewed: 2/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

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

Comment on lines 1416 to +1418
c.argument('priority',
arg_type=get_enum_type(Priority, default=None),
help="Priority. Use 'Spot' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' to deploy Azure spot VM and/or VMSS. Default to Regular.")
help="Priority. Use 'Spot' or 'SpotPlus' to run short-lived workloads in a cost-effective way. 'Low' enum will be deprecated in the future. Please use 'Spot' or 'SpotPlus' to deploy Azure spot VM and/or VMSS. Default to Regular.")
@a0x1ab Aditya Pujara (a0x1ab) added the Request X Engineering Agent Request X Engineering Agent testing and review label Sep 4, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

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

@x-engineering-agent

Copy link
Copy Markdown
Contributor

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

FAIL (exit 1)

Selectors: test_vm_commands (module)
PR head ref: priority-spotplus
PR head sha: 56387b012eee5a2a5ee2cde613723eadb7949471
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_vm_commands.py

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

Live-test recordings: 1 regenerated — archived in workflow artifact live-test-pr-34030 (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:13790: 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_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 380 items

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

=================================== 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:2744 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 in 4.00s ===============================

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

@yonzhan

Copy link
Copy Markdown
Collaborator

Compute

@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.

William (@william051200)

Upstream CI

Azure.azure-cli Full Test

  • Result: failure
  • Included checks: Azure.azure-cli Full Test (Automation Full Test Python314 Profile Latest instance2), Azure.azure-cli Full Test (Automation Full Test Python312 Profile Latest instance2)
  • Failure details:
    • Automation Full Test Python312 Profile Latest instance2 / azdev test
      • Evidence: Matchers failed: host - assertion failure: azcliprod.blob.core.windows.net != raw.githubusercontent.com; path - assertion failure: /cli/vm/aliases.json != /Azure/azure-rest-api-specs/main/arm-compute/quickstart-templates/aliases.json. Can't overwrite existing cassette ('.../recordings/test_vm_vmss_create_with_spot_plus_priority.yaml') in record mode 'once'. No match for the request (GET https://azcliprod.blob.core.windows.net/cli/vm/aliases.json) was found.
      • Next action: Re-record test_vm_vmss_create_with_spot_plus_priority.yaml against the current aliases.json source so the recorded request host/path match what the test actually issues.
      • Verify: Re-run Automation Full Test Python312 Profile Latest instance2 / azdev test and confirm the cassette match succeeds.
    • Automation Full Test Python314 Profile Latest instance2 / azdev test
      • Evidence: Same cassette mismatch as above, reproduced on the Python 3.14 profile job.
      • Next action: Same fix as above; a single recording re-capture resolves both jobs.
      • Verify: Re-run Automation Full Test Python314 Profile Latest instance2 / azdev test and confirm the cassette match succeeds.

Test validation

  • Live test: Failed with conclusion failure (same cassette mismatch as the Azure DevOps CI failure below — the new test_vm_vmss_create_with_spot_plus_priority recording doesn't match the live aliases.json request the test now issues).
  • Regression coverage: Present for vm: 1 focused test file and 1 recording file changed alongside the production _params.py change — no coverage gap.

Classification

Both failing jobs point to the same root cause and are PR-related: the recording this PR adds (test_vm_vmss_create_with_spot_plus_priority.yaml) was captured against an aliases.json host/path (raw.githubusercontent.com/.../quickstart-templates/aliases.json) that no longer matches what the code under test requests at runtime (azcliprod.blob.core.windows.net/cli/vm/aliases.json). This is not an unrelated/infra flake — it is the PR's own new test failing to replay because its cassette is stale relative to the current request path.

Next action: Re-record test_vm_vmss_create_with_spot_plus_priority.yaml (or otherwise update the mocked aliases.json request in the test) so the recorded host/path matches the live request, then rerun azdev test vm locally and re-trigger the two failing Azure DevOps jobs to confirm.

Risk assessment

25/100 · Medium · High confidence

The Medium rating is driven by public CLI behavior.

  • Change scope: 3 changed files, 2361 changed lines (+2358 / -3), including 1 production file.
  • Affected components: vm
  • Risk drivers: public CLI behavior (+18)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for vm before merge.

@x-engineering-agent x-engineering-agent Bot added X Engineering Agent Reviewed Pull request reviewed by X Engineering Agent and removed Request X Engineering Agent Request X Engineering Agent testing and review labels Sep 4, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

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

@yanzhudd
Julie Zhu (yanzhudd) merged commit 9ebc37e into Azure:dev Sep 4, 2026
50 checks passed
@william051200
William (william051200) deleted the priority-spotplus branch September 4, 2026 04:00
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.

[Compute] Add SpotPlus Priority Option to VM/VMSS Creation

5 participants