{Compute} az vm/vmss create: Add new param --schedule-profile-start and --minimum-commitment-days to support future capacity reservation - #34031
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The create operation’s LRO polling was changed to final-state-via: location inconsistently with related operations, which is likely to break async polling behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds Azure CLI support for Future Capacity Reservations by surfacing the new schedule profile fields (start/minimumCommitmentDays/modifiableUntil) and reservation state info on az capacity reservation commands, aligned to Compute API version 2026-04-01.
Changes:
- Adds a new live-only scenario test validating
scheduleProfile.*appears on create/show/list andinstanceView.reservationStateInfo.reservationStateappears with--instance-view. - Updates AAZ-generated
capacity reservationcommands to2026-04-01and extends response schemas to includescheduleProfile,systemData, andreservationStateInfo. - Adds new create-time schedule profile arguments and request shaping for
scheduleProfileincapacity reservation create.
File summaries
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py | Adds a live-only test covering create/show/list + instance view for Future Capacity Reservations. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/_wait.py | Bumps API version and extends wait schema to include schedule profile + reservation state info. |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/_list.py | Bumps API version and extends list schema to include schedule profile + reservation state info (and adds --expand). |
| src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/_create.py | Adds schedule profile args and request shaping; bumps API version; changes LRO polling behavior. |
Review details
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/capacity/reservation/_create.py:170
- Same as above: the 200/201 path also uses
final-state-via: location, which may cause incorrect LRO polling if the operation follows the Compute RPAzure-AsyncOperationpattern.
if session.http_response.status_code in [200, 201]:
return self.client.build_lro_polling(
self.ctx.args.no_wait,
session,
self.on_200_201,
self.on_error,
lro_options={"final-state-via": "location"},
path_format_arguments=self.url_parameters,
)
- Files reviewed: 4/4 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return self.client.build_lro_polling( | ||
| self.ctx.args.no_wait, | ||
| session, | ||
| self.on_200_201, | ||
| self.on_error, | ||
| lro_options={"final-state-via": "azure-async-operation"}, | ||
| lro_options={"final-state-via": "location"}, | ||
| path_format_arguments=self.url_parameters, | ||
| ) |
| :example: Create a Future capacity reservation. | ||
| az capacity reservation create -c ReservationGroupName -n ReservationName -g MyResourceGroup --sku Standard_A1_v2 --capacity 5 --schedule-profile-start 2026-12-01T12:00:00Z --minimum-commitment-days 30 |
| _args_schema.end = AAZStrArg( | ||
| options=["--end"], | ||
| arg_group="ScheduleProfile", | ||
| help="The required end date for Block capacity reservations. Must be after the start date, with a duration of either 1–14 whole days or 3–26 whole weeks. Example: 2025-06-28.", | ||
| ) |
|
Compute |
🤖 PR Validation —⚠️ Review suggested
Related command
az capacity reservation create/show/listDescription
Resolve #33898
aaz Azure/aaz#1082
Testing Guide
Refer to
azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:test_future_capacity_reservationCurrently not able to run yet. No access to Canary
Provided private preview package for the service team to test.
History Notes
[Compute]
az capacity reservation create: Add new param--schedule-profile-startand--minimum-commitment-daysto support future 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.