Skip to content

[Compute] Adding Scheduledevents to VM and VMSS#29123

Open
haagha wants to merge 9 commits intomainfrom
scheduledevents
Open

[Compute] Adding Scheduledevents to VM and VMSS#29123
haagha wants to merge 9 commits intomainfrom
scheduledevents

Conversation

@haagha
Copy link
Member

@haagha haagha commented Jan 30, 2026

Description

https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/1511

Mandatory Checklist

  • SHOULD update ChangeLog.md file(s) appropriately
    • Update src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md.
      • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header in the past tense.
    • Should not change ChangeLog.md if no new release is required, such as fixing test case only.
  • SHOULD regenerate markdown help files if there is cmdlet API change. Instruction
  • SHOULD have proper test coverage for changes in pull request.
  • SHOULD NOT adjust version of module manually in pull request

Haider Agha added 3 commits January 28, 2026 17:33
…zVM, and Update-AzVmss cmdlets

- Introduced `-ScheduledEventsApiVersion` to specify the API version for Scheduled Events configuration.
- Added `-EnableAllInstancesDown` to auto-approve Scheduled Events when all instances are down.
- Updated related help documentation for cmdlets to reflect new parameters.
- Enhanced handling of Scheduled Events policy in the cmdlet implementations.
@azure-client-tools-bot-prd
Copy link

Thanks for your contribution! The pull request validation has started. Please revisit this comment for updated status.

Copy link
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

Adds Scheduled Events configuration support to Az.Compute VM/VMSS (and Availability Set) cmdlets by introducing two new parameters that populate ScheduledEventsPolicy in the corresponding ARM payloads.

Changes:

  • Added -ScheduledEventsApiVersion and -EnableAllInstancesDown parameters to VM/VMSS/Availability Set create/update cmdlets and wired them into request models.
  • Updated generated/help markdown to document the new parameters.
  • Added new scenario tests (and one new recording) intended to validate the behavior.

Reviewed changes

Copilot reviewed 23 out of 25 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/Compute/Compute/help/Update-AzVmss.md Documents new Scheduled Events parameters for Update-AzVmss (and adds -ProgressAction entry).
src/Compute/Compute/help/Update-AzVM.md Documents new Scheduled Events parameters for Update-AzVM (and adds -ProgressAction entry).
src/Compute/Compute/help/Update-AzAvailabilitySet.md Documents new Scheduled Events parameters for Update-AzAvailabilitySet (and adds -ProgressAction entry).
src/Compute/Compute/help/New-AzVmss.md Documents new Scheduled Events parameters for New-AzVmss and updates syntax block.
src/Compute/Compute/help/New-AzVM.md Documents new Scheduled Events parameters for New-AzVM and updates syntax block.
src/Compute/Compute/VirtualMachine/Operation/UpdateAzureVMCommand.cs Adds parameters and populates ScheduledEventsPolicy for VM update calls.
src/Compute/Compute/VirtualMachine/Operation/NewAzureVMCommand.cs Adds parameters and passes Scheduled Events inputs through strategy-based VM creation; also forwards ScheduledEventsPolicy from PSVirtualMachine to the SDK model.
src/Compute/Compute/Strategies/ComputeRp/VirtualMachineStrategy.cs Extends strategy VM config builder to construct ScheduledEventsPolicy during VM creation.
src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs Extends strategy VMSS config builder to construct ScheduledEventsPolicy during VMSS creation.
src/Compute/Compute/Models/PSVirtualMachine.cs Adds ScheduledEventsPolicy property to the PowerShell VM model.
src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs Adds Scheduled Events parameters to VMSS create cmdlet path and passes them into strategy config.
src/Compute/Compute/Manual/PSVirtualMachineScaleSet.cs Adds ScheduledEventsPolicy property to the PowerShell VMSS model.
src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs Adds Scheduled Events parameters to Update-AzVmss and applies them only in PUT path (not PATCH).
src/Compute/Compute/ChangeLog.md Adds an Upcoming Release note about the new parameters.
src/Compute/Compute/AvailabilitySets/UpdateAzureAvailabilitySetCommand.cs Adds parameters and populates ScheduledEventsPolicy for availability set updates.
src/Compute/Compute.Test/SessionRecords/Microsoft.Azure.Commands.Compute.Test.ScenarioTests.AvailabilitySetTests/TestAvailabilitySetScheduledEventsPolicy.json Adds a recording for the new availability set Scheduled Events scenario.
src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.ps1 Adds a VM Scheduled Events scenario test script.
src/Compute/Compute.Test/ScenarioTests/VirtualMachineTests.cs Registers the new VM Scheduled Events scenario test for check-in runs.
src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.ps1 Adds a VMSS Scheduled Events scenario test script.
src/Compute/Compute.Test/ScenarioTests/VirtualMachineScaleSetTests.cs Registers the new VMSS Scheduled Events scenario test for check-in runs.
src/Compute/Compute.Test/ScenarioTests/StrategiesVirtualMachineTests.ps1 Adds a strategy-based New-AzVM SimpleParameterSet Scheduled Events scenario test script.
src/Compute/Compute.Test/ScenarioTests/StrategiesVirtualMachineTests.cs Registers the new strategy-based Scheduled Events scenario test for check-in runs.
src/Compute/Compute.Test/ScenarioTests/AvailabilitySetTests.ps1 Adds an availability set Scheduled Events scenario test script.
src/Compute/Compute.Test/ScenarioTests/AvailabilitySetTests.cs Registers the new availability set Scheduled Events scenario test for check-in runs.
Comments suppressed due to low confidence (1)

src/Compute/Compute/help/New-AzVmss.md:651

  • The -HighSpeedInterconnectPlacement parameter help no longer lists its accepted values (e.g., None/Trunk). Other cmdlets in this module include an "Accepted values:" line for constrained strings; please restore that here to avoid losing important guidance.
### -HighSpeedInterconnectPlacement
Specifies the high speed interconnect placement for the virtual machine scale set.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
</details>

Copilot AI review requested due to automatic review settings February 3, 2026 16:48
Copy link
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

Copilot reviewed 19 out of 21 changed files in this pull request and generated 3 comments.

Copy link
Member

@isra-fel isra-fel left a comment

Choose a reason for hiding this comment

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

Hi, please see the comments inline, and resolve the conflicts. THanks

@github-actions
Copy link

This PR was labeled "needs-revision" because it has unresolved review comments or CI failures.
Please resolve all open review comments and make sure all CI checks are green. Refer to our guide to troubleshoot common CI failures.

Copilot AI review requested due to automatic review settings February 20, 2026 18:06
@haagha haagha requested a review from isra-fel February 20, 2026 18:09
Copy link
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

Copilot reviewed 17 out of 20 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 23, 2026 16:56
Copy link
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

Copilot reviewed 17 out of 20 changed files in this pull request and generated 8 comments.

Comment on lines +869 to +883
### -ProgressAction
{{ Fill ProgressAction Description }}

```yaml
Type: System.Management.Automation.ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The help includes a -ProgressAction parameter block with the placeholder text "{{ Fill ProgressAction Description }}". This should not ship as-is; either remove the ProgressAction section entirely (it’s stripped by repo tooling) or replace it with the standard description used elsewhere for common parameters and re-run help generation.

Suggested change
### -ProgressAction
{{ Fill ProgressAction Description }}
```yaml
Type: System.Management.Automation.ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

Copilot uses AI. Check for mistakes.
Comment on lines 638 to 646
### -HighSpeedInterconnectPlacement
Specifies the high speed interconnect placement for the virtual machine scale set.

```yaml
Type: System.String
Parameter Sets: (All)
Aliases:
Accepted values: None, Trunk

Required: False
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The HighSpeedInterconnectPlacement parameter block no longer lists the accepted values (previously None and Trunk). Since the cmdlet constrains this via an argument completer/validation, the help should include the accepted values to avoid users guessing invalid inputs.

Copilot uses AI. Check for mistakes.
* Added support for Disk Availability Policy
- Added `-ActionOnDiskDelay` parameter to `New-AzDiskConfig` cmdlet to configure disk availability behavior
- Added `-ActionOnDiskDelay` parameter to `New-AzDiskUpdateConfig` cmdlet to update disk availability behavior
* Added `-ScheduledEventsApiVersion` and `-EnableAllInstancesDown` parameters to `Update-AzAvailabilitySet`, `Update-AzVM`, `Update-AzVmss`, `New-AzVM` (SimpleParameterSet), and `New-AzVmss` cmdlets for configuring Scheduled Events policy for virtual machines and virtual machine scale sets.
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Changelog entry is missing a reference to the tracked issue for this feature (per repo ChangeLog guidance). Please add an issue reference like "Fixed issue [#1511]" or "Related issue [#1511]" under the new Scheduled Events entry.

Copilot generated this review using guidance from repository custom instructions.
IncludeZones = includeZone,
ExcludeZones = excludeZone
},
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

ScheduledEventsPolicy is created when scheduledEventsApiVersion is a non-null empty string. Because the nested assignment uses string.IsNullOrEmpty, this can produce an empty ScheduledEventsPolicy object (no sub-properties set), which is likely invalid and may cause server-side validation errors. Consider treating empty strings as not provided (use string.IsNullOrEmpty in the outer conditional as well), and/or normalize empty to null before building the model.

Suggested change
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
ScheduledEventsPolicy = (string.IsNullOrEmpty(scheduledEventsApiVersion) && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy

Copilot uses AI. Check for mistakes.
} : null,
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement,
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

ScheduledEventsPolicy is created when scheduledEventsApiVersion is a non-null empty string. Because the nested assignment uses string.IsNullOrEmpty, this can produce an empty ScheduledEventsPolicy object (no sub-properties set), which is likely invalid and may cause server-side validation errors. Consider treating empty strings as not provided (use string.IsNullOrEmpty in the outer conditional as well), and/or normalize empty to null before building the model.

Suggested change
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
ScheduledEventsPolicy = (string.IsNullOrEmpty(scheduledEventsApiVersion) && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy

Copilot uses AI. Check for mistakes.
} : null,
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement
HighSpeedInterconnectPlacement = highSpeedInterconnectPlacement,
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

ScheduledEventsPolicy is created when scheduledEventsApiVersion is a non-null empty string. Because the nested assignment uses string.IsNullOrEmpty, this can produce an empty ScheduledEventsPolicy object (no sub-properties set), which is likely invalid and may cause server-side validation errors. Consider treating empty strings as not provided (use string.IsNullOrEmpty in the outer conditional as well), and/or normalize empty to null before building the model.

Suggested change
ScheduledEventsPolicy = (scheduledEventsApiVersion == null && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy
ScheduledEventsPolicy = (string.IsNullOrEmpty(scheduledEventsApiVersion) && enableAllInstancesDown == null) ? null : new ScheduledEventsPolicy

Copilot uses AI. Check for mistakes.
Comment on lines +484 to +494
[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered. Format: YYYY-MM-DD")]
public string ScheduledEventsApiVersion { get; set; }

[Parameter(
Mandatory = false,
ValueFromPipelineByPropertyName = true,
HelpMessage = "Specifies if Scheduled Events should be auto-approved when all instances are down.")]
public bool? EnableAllInstancesDown { get; set; }
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

These parameters are accepted by the cmdlet, but they are not applied in the PATCH path (VirtualMachineScaleSetUpdate), per the comment below. As a result, users can pass -ScheduledEventsApiVersion / -EnableAllInstancesDown and see no effect depending on parameter set. Consider restricting these parameters to the parameter set(s) that use the PUT/CreateOrUpdate path, or emitting a terminating error/warning when they’re bound but the cmdlet is using the PATCH model.

Copilot uses AI. Check for mistakes.
```

### -ScheduledEventsApiVersion
Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered. Format: YYYY-MM-DD
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

The help shows -ScheduledEventsApiVersion / -EnableAllInstancesDown as available for all parameter sets, but the implementation only supports these when the cmdlet takes the PUT/CreateOrUpdate path (per code comment in VirtualMachineScaleSetUpdateMethod). Please update the help text to document this requirement (or adjust parameter sets so the help is accurate).

Suggested change
Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered. Format: YYYY-MM-DD
Specifies the api-version to determine which Scheduled Events configuration schema version will be delivered. Format: YYYY-MM-DD. This parameter is only applied when `Update-AzVmss` performs a CreateOrUpdate (PUT) operation and is ignored for other update paths.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link

‼️ DO NOT MERGE THIS PR ‼️
This PR was labeled "Do Not Merge" because it contains code change that cannot be merged. Please contact the reviewer for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants