Skip to content

[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

Open
william051200 wants to merge 10 commits into
Azure:devfrom
william051200:33320-scheduled-events

Conversation

@william051200
Copy link
Copy Markdown
Member

Related command

az vm create/ update/ show
az vmss create/ update/ show
az availability-set create/ show

Description

Resolve #33320

Current PR created due to previous PR only focus on availability-set update.

Updated availability-set aaz code from 2024-07-01 to 2025-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:

  1. test_vm_avset_scheduled_events_policy_parameters
  2. test_vmss_scheduled_events_policy
  3. test_vm_scheduled_events_policy

Microsoft.Compute/SendScheduledEventsPolicy is required

History Notes

[Compute] az vm create/ update/ show: Support scheduled events profile via new param --scheduled-events-api-version and --enable-all-instance-down
[Compute] az vmss create/ update/ show: Support scheduled events profile via new param --scheduled-events-api-version and --enable-all-instance-down
[Compute] az availability-set create/ show: Support scheduled events profile via new param --scheduled-events-api-version and --enable-all-instance-down


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

Copilot AI review requested due to automatic review settings May 28, 2026 01:59
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 28, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd Bot commented May 28, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️vm
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd vm availability-set create cmd vm availability-set create added parameter enable_all_instance_down
⚠️ 1006 - ParaAdd vm availability-set create cmd vm availability-set create added parameter scheduled_events_api_version
⚠️ 1006 - ParaAdd vm create cmd vm create added parameter enable_all_instance_down
⚠️ 1006 - ParaAdd vm create cmd vm create added parameter scheduled_events_api_version
⚠️ 1006 - ParaAdd vm update cmd vm update added parameter enable_all_instance_down
⚠️ 1006 - ParaAdd vm update cmd vm update added parameter scheduled_events_api_version
⚠️ 1006 - ParaAdd vmss create cmd vmss create added parameter enable_all_instance_down
⚠️ 1006 - ParaAdd vmss create cmd vmss create added parameter scheduled_events_api_version
⚠️ 1006 - ParaAdd vmss update cmd vmss update added parameter enable_all_instance_down
⚠️ 1006 - ParaAdd vmss update cmd vmss update added parameter scheduled_events_api_version

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 28, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-version and --enable-all-instance-down/--all-instance-down arguments 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.

Comment on lines +403 to +404
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.')
Comment on lines +477 to +478
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.')
Comment on lines +933 to +934
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.')
Comment on lines +2066 to 2079
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",
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure Compute, ScheduledEventsProfile changes

5 participants