[Compute] az capacity reservation/ az capacity reservation group/ az vm: Support Open Capacity Reservation - #33901
[Compute] az capacity reservation/ az capacity reservation group/ az vm: Support Open Capacity Reservation#33901William (william051200) wants to merge 20 commits into
az capacity reservation/ az capacity reservation group/ az vm: Support Open Capacity Reservation#33901Conversation
|
Hi William (@william051200), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR adds Azure CLI support for Open Capacity Reservation scenarios across the VM and Capacity Reservation command set, including wiring new properties through the VM create/update payload and exposing reservation type on capacity reservation group create.
Changes:
- Add VM support for opting out of capacity reservation assignment via
--disable-capacity-reservation-assignment/--no-capacity-reservation, and ensure the property round-trips through show/update flows. - Add
--reservation-typefor capacity reservation group create to enableOpen(plus schema updates to show utilization details needed for Open reservations). - Refresh AAZ-generated schemas (notably to
2026-04-01) and add a new live-only scenario test for Open Capacity Reservation.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Adds a live-only end-to-end scenario validating Open Capacity Reservation behavior and utilization reporting. |
| src/azure-cli/azure/cli/command_modules/vm/operations/vm.py | Extends snake_case conversion to include disableCapacityReservationAssignment. |
| src/azure-cli/azure/cli/command_modules/vm/custom.py | Wires disable_capacity_reservation_assignment through VM create/update and exposes reservation_type in capacity reservation group wrappers. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_wait.py | Updates VM AAZ wait schema/api-version and includes new properties in the response model. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_update.py | Updates VM AAZ update schema/api-version and adds new modeled properties. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_show.py | Updates VM AAZ show schema/api-version and includes disableCapacityReservationAssignment in the model. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_list.py | Updates VM list schema/api-version and expands modeled fields. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_list_all.py | Updates VM list-all schema/api-version and expands modeled fields. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/_create.py | Updates VM create schema/api-version and includes disableCapacityReservationAssignment modeling. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_create.py | Adds reservationType modeling for capacity reservation group creation and bumps api-version. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_update.py | Adds reservationType modeling for update and bumps api-version. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_show.py | Adds reservationType + utilization-related modeling and bumps api-version. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/group/_list.py | Adds reservationType + utilization-related modeling and bumps api-version. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/_show.py | Adds utilization details needed by the new Open reservation scenario and bumps api-version. |
| src/azure-cli/azure/cli/command_modules/vm/_template_builder.py | Adds disableCapacityReservationAssignment to the ARM template payload and bumps VM apiVersion. |
| src/azure-cli/azure/cli/command_modules/vm/_params.py | Adds CLI args for --disable-capacity-reservation-assignment/--no-capacity-reservation and --reservation-type. |
| src/azure-cli/azure/cli/command_modules/vm/_help.py | Adds help examples for the new/updated capacity reservation and VM flags. |
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/vm/_params.py:1607
--reservation-typeis documented as immutable, but it’s currently registered in the generalcapacity reservation groupargument context, which makes it available forcapacity reservation group updateas well. That implies users can change it after creation and can lead to service-side errors.
Move reservation_type so it’s only accepted on capacity reservation group create (and keep it out of update).
with self.argument_context('capacity reservation group') as c:
c.argument('location', arg_type=get_location_type(self.cli_ctx), validator=get_default_location_from_resource_group)
c.argument('capacity_reservation_group_name', options_list=['--capacity-reservation-group', '-n'],
help='The name of the capacity reservation group.')
c.argument('tags', tags_type)
c.argument('sharing_profile', nargs='*', help='Space-separated subscription resource IDs or nothing. Specify the settings to enable sharing across subscriptions for the capacity reservation group resource. Specify it to nothing to unsharing.')
c.argument('reservation_type', arg_type=get_enum_type(ReservationType), help='The capacity reservation type. The reservation type cannot be changed after the capacity reservation group is created.')
with self.argument_context('capacity reservation group create') as c:
c.argument('zones', zones_type, help='Availability Zones to use for this capacity reservation group. If not provided, the group supports only regional resources in the region. If provided, enforces each capacity reservation in the group to be in one of the zones.')
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - name: Update an open capacity reservation group. | ||
| text: az capacity reservation group update -n ReservationGroupName -g MyResourceGroup --reservation-type Open |
|
/azp run |
|
/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 will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
|
/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). |
Live test results —
|
There was a problem hiding this comment.
Automated CI Summary
The current head commit (faceaa7) has failing checks:
- Azure.azure-cli Full Test —
failure: Build #20260819.20 had test failures - Automation Full Test Python314 Profile Latest instance2 —
failure: details - Automation Full Test Python312 Profile Latest instance2 —
failure: details
Please investigate the failing test instances above (Python 3.12 and 3.14 automation full-test runs) and push a fix. CI will re-run automatically on the next push.
|
🔔 Routing this PR to @Azure/act-observability-squad. |
🤖 PR Validation — ❌ Action needed
❌AzureCLI-FullTest
Related command
az capacity reservation showaz capacity reservation group create/ update/ show/ listaz vm create/ update/ show/ listDescription
Resolve #33769
aaz Azure/aaz#1064
Testing Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:test_open_capacity_reservationHistory Notes
[Compute]
az capacity reservation group create/ update: Add new parameter--reservation-typeto support Open Capacity Reservation[Compute]
az vm create/ update: Add new parameter--disable-capacity-reservation-assignmentto support Open Capacity ReservationThis 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.