[Compute] vm/ vmss create/ update & vm availability-set create/ update: Support scheduled events profile via new param --scheduled-events-api-version and --enable-all-instance-down#33451
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| vm availability-set create | cmd vm availability-set create added parameter enable_all_instance_down |
||
| vm availability-set create | cmd vm availability-set create added parameter scheduled_events_api_version |
||
| vm create | cmd vm create added parameter enable_all_instance_down |
||
| vm create | cmd vm create added parameter scheduled_events_api_version |
||
| vm update | cmd vm update added parameter enable_all_instance_down |
||
| vm update | cmd vm update added parameter scheduled_events_api_version |
||
| vmss create | cmd vmss create added parameter enable_all_instance_down |
||
| vmss create | cmd vmss create added parameter scheduled_events_api_version |
||
| vmss update | cmd vmss update added parameter enable_all_instance_down |
||
| vmss update | cmd vmss update added parameter scheduled_events_api_version |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull request overview
This PR adds scheduled events policy support for VM, VMSS, and availability set create/update flows, extending prior availability-set update coverage and surfacing the new scheduled-events API version and all-instances-down auto-approval settings.
Changes:
- Adds
--scheduled-events-api-version/--se-api-versionand--enable-all-instance-down/--all-instance-downarguments for VM, VMSS, and availability set commands. - Updates VM/VMSS/availability-set template construction and update logic to emit the new scheduled-events policy properties.
- Regenerates availability-set show AAZ output schema and updates scenario tests/recordings for the new properties.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/azure-cli/azure/cli/command_modules/vm/_params.py |
Adds new scheduled-events command arguments. |
src/azure-cli/azure/cli/command_modules/vm/custom.py |
Wires new arguments through create/update command implementations. |
src/azure-cli/azure/cli/command_modules/vm/_template_builder.py |
Adds new scheduled-events properties to ARM template resources and updates API versions. |
src/azure-cli/azure/cli/command_modules/vm/aaz/latest/vm/availability_set/_show.py |
Updates availability-set show schema to API 2025-04-01. |
src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_commands.py |
Expands scheduled-events scenario coverage for VM, VMSS, and availability sets. |
src/azure-cli/azure/cli/command_modules/vm/tests/latest/recordings/test_vm_avset_scheduled_events_policy_parameters.yaml |
Refreshes availability-set scheduled-events recording. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| c.argument('scheduled_events_api_version', options_list=['--scheduled-events-api-version', '--se-api-version'], help='Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered.') | ||
| c.argument('enable_all_instance_down', options_list=['--enable-all-instance-down', '--all-instance-down'], arg_type=get_three_state_flag(), help='Specifies if Scheduled Events should be auto-approved when all instances are down. Its default value is true.') |
| c.argument('scheduled_events_api_version', options_list=['--scheduled-events-api-version', '--se-api-version'], help='Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered.') | ||
| c.argument('enable_all_instance_down', options_list=['--enable-all-instance-down', '--all-instance-down'], arg_type=get_three_state_flag(), help='Specifies if Scheduled Events should be auto-approved when all instances are down. Its default value is true.') |
| c.argument('scheduled_events_api_version', options_list=['--scheduled-events-api-version', '--se-api-version'], help='Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered.') | ||
| c.argument('enable_all_instance_down', options_list=['--enable-all-instance-down', '--all-instance-down'], arg_type=get_three_state_flag(), help='Specifies if Scheduled Events should be auto-approved when all instances are down. Its default value is true.') |
| if vm.get("scheduled_events_policy") is None: | ||
| vm["scheduled_events_policy"] = { | ||
| "scheduled_events_additional_publishing_targets": { | ||
| "event_grid_and_resource_graph": { | ||
| "enable": additional_scheduled_events if additional_scheduled_events is not None else False | ||
| }, | ||
| "enable": False | ||
| } | ||
| }, | ||
| "user_initiated_reboot": { | ||
| "automatically_approve": | ||
| enable_user_reboot_scheduled_events if enable_user_reboot_scheduled_events is not None else False # pylint: disable=line-too-long | ||
| "automatically_approve": False | ||
| }, | ||
| "user_initiated_redeploy": { | ||
| "automatically_approve": | ||
| enable_user_redeploy_scheduled_events if enable_user_redeploy_scheduled_events is not None else False # pylint: disable=line-too-long | ||
| "automatically_approve": False | ||
| } | ||
| } |
| 'location': location, | ||
| 'tags': tags, | ||
| 'apiVersion': cmd.get_api_version(ResourceType.MGMT_COMPUTE, operation_group='availability_sets'), | ||
| 'apiVersion': "2025-04-01", |
Related command
az vm create/ update/ showaz vmss create/ update/ showaz availability-set create/ showDescription
Resolve #33320
Current PR created due to previous PR only focus on
availability-set update.Updated availability-set aaz code from
2024-07-01to2025-04-01, no aaz code export from swagger, version already exist.Testing Guide
In azure-cli\src\azure-cli\azure\cli\command_modules\vm\tests\latest\test_vm_commands.py:
Microsoft.Compute/SendScheduledEventsPolicyis requiredHistory Notes
[Compute]
az vm create/ update/ show: Support scheduled events profile via new param--scheduled-events-api-versionand--enable-all-instance-down[Compute]
az vmss create/ update/ show: Support scheduled events profile via new param--scheduled-events-api-versionand--enable-all-instance-down[Compute]
az availability-set create/ show: Support scheduled events profile via new param--scheduled-events-api-versionand--enable-all-instance-downThis 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.