Skip to content

Az.Compute: Add -DisableCapacityReservationAssignment and surface capacity reservation details on VMSS VMs - #30013

Draft
Haider Agha (haagha) with Copilot wants to merge 3 commits into
mainfrom
copilot/az-compute-surface-vmss-vm-capacity-reservation
Draft

Az.Compute: Add -DisableCapacityReservationAssignment and surface capacity reservation details on VMSS VMs#30013
Haider Agha (haagha) with Copilot wants to merge 3 commits into
mainfrom
copilot/az-compute-surface-vmss-vm-capacity-reservation

Conversation

Copilot AI commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

VMSS customers need a way to opt all instances out of capacity reservation assignment and to inspect the resulting capacity reservation state on individual VMSS VMs.

Cmdlet changes

  • Added -DisableCapacityReservationAssignment (SwitchParameter) to New-AzVmssConfig, New-AzVmss (simple parameter set), and Update-AzVmss, mapping to VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment.
  • -DisableCapacityReservationAssignment and -CapacityReservationGroupId are mutually exclusive; using both throws a PSArgumentException.
  • Update-AzVmss rejects -DisableCapacityReservationAssignment when no -VirtualMachineScaleSet object is supplied, since the PATCH model doesn't support CapacityReservation — consistent with the existing -ScheduledEventsApiVersion restriction.
$vmssConfig = New-AzVmssConfig -Location "eastus" -SkuCapacity 2 -DisableCapacityReservationAssignment
New-AzVmss -ResourceGroupName "myRg" -VMScaleSetName "myVmss" -VirtualMachineScaleSet $vmssConfig

# Apply to an existing VMSS (requires piping the object for the CreateOrUpdate/PUT path)
$vmss = Get-AzVmss -ResourceGroupName "myRg" -VMScaleSetName "myVmss"
Update-AzVmss -ResourceGroupName "myRg" -VMScaleSetName "myVmss" -VirtualMachineScaleSet $vmss -DisableCapacityReservationAssignment

Output model changes

  • Get-AzVmssVM now surfaces CapacityReservation on the model view (PSVirtualMachineScaleSetVM) and CapacityReservationType on the -InstanceView output (PSVirtualMachineScaleSetVMInstanceView).

Docs & tests

  • Updated help markdown for New-AzVmssConfig, New-AzVmss, and Update-AzVmss (syntax + parameter descriptions).
  • Updated ChangeLog.md.
  • Added a scenario test exercising the new parameter across all three cmdlets, update merge semantics, the PATCH-path rejection, Get-AzVmssVM/-InstanceView output, and the mutual-exclusivity negative case.

Note: Build/test validation could not be run end-to-end in the development sandbox due to blocked NuGet restore to the internal package feed (pre-existing environment restriction). Changes were verified via manual review and the automated code review tool.

Copilot AI lite review requested due to automatic review settings August 14, 2026 14:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@azure-pipelines

Copy link
Copy Markdown
Contributor
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

…ation VMSS VM properties

Co-authored-by: haagha <64601174+haagha@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 14, 2026 14:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 3 out of 7 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/Compute/Compute/ChangeLog.md:25

  • The PR description says "Fixes #1567", but issue #1567 is about the Azure PowerShell Start menu shortcut launching 32-bit Windows PowerShell on x64 machines; this ChangeLog entry (and the code changes in this PR) are about VMSS capacity reservation assignment instead. Please update the PR’s linked issue (or remove the "Fixes" reference) and, if there is a relevant issue for this VMSS change, consider referencing it in the ChangeLog entry.
* Added `-DisableCapacityReservationAssignment` parameter to `New-AzVmss`, `New-AzVmssConfig`, and `Update-AzVmss` to opt VMSS instances out of capacity reservation assignment.
* Added `CapacityReservation` property to `Get-AzVmssVM` output and `CapacityReservationType` property to its `-InstanceView` output.

…h; update tests and help

Co-authored-by: haagha <64601174+haagha@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 14, 2026 14:36
Copilot AI changed the title [WIP] Add cmdlets for VMSS VM capacity reservation details Az.Compute: Add -DisableCapacityReservationAssignment and surface capacity reservation details on VMSS VMs Aug 14, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 8 out of 12 changed files in this pull request and generated no new comments.

Suppressed comments (4)

src/Compute/Compute/ChangeLog.md:24

  • Changelog entry uses the acronym “VMSS” without expanding it on first use in the “Upcoming Release” section. For user-facing release notes, please expand it (e.g., “Virtual Machine Scale Set (VMSS)”).
* Added `-DisableCapacityReservationAssignment` parameter to `New-AzVmss`, `New-AzVmssConfig`, and `Update-AzVmss` to opt VMSS instances out of capacity reservation assignment.

src/Compute/Compute/ChangeLog.md:25

  • The PR description says “Fixes #1567”, but the linked issue #1567 is about a Windows Start menu shortcut launching 32-bit PowerShell, which doesn’t match these VMSS capacity reservation changes. Please confirm the correct issue reference (or remove it) and add the appropriate issue link in this changelog entry if applicable.
* Added `-DisableCapacityReservationAssignment` parameter to `New-AzVmss`, `New-AzVmssConfig`, and `Update-AzVmss` to opt VMSS instances out of capacity reservation assignment.
* Added `CapacityReservation` property to `Get-AzVmssVM` output and `CapacityReservationType` property to its `-InstanceView` output.

src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1:937

  • The test synopsis claims it covers the “config+New-AzVmss pipeline”, but the test only creates a config object and asserts the in-memory property; it doesn’t deploy via New-AzVmss. Either add the pipeline deployment or adjust the synopsis to match what’s actually exercised.
Tests -DisableCapacityReservationAssignment on New-AzVmssConfig/New-AzVmss (both the simple
parameter set and the config+New-AzVmss pipeline), on Update-AzVmss, verifies the resulting
CapacityReservation/CapacityReservationType properties surfaced by Get-AzVmssVM, and validates
that -DisableCapacityReservationAssignment and -CapacityReservationGroupId are mutually exclusive.

src/Compute/Compute/help/Update-AzVmss.md:308

  • Grammar: “opted out from” should be “opted out of” in this parameter description (same phrasing appears in the other VMSS cmdlet help for this parameter).
Specifies that the virtual machine scale set instances are explicitly opted out from being associated with any capacity reservation. When set, the instances will not be allowed to implicitly or explicitly associate with any type of capacity reservation and will consume capacity from the publicly available capacity. Minimum api-version: 2026-04-01. This parameter is only supported when updating a Virtual Machine Scale Set via the `-VirtualMachineScaleSet` object parameter (e.g. piping the output of `Get-AzVmss`).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Start menu shortcut points to 32-bit PowerShell even on x64 Windows making 64-bit cmdlets unrecognized

3 participants