You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
️✔️PowerShell Core - Windows️✔️Windows PowerShell - Windows
Capacity reservation assignment handling for VM and VMSS cmdlets conflated “parameter bound” with “switch enabled” and could not preserve explicit CRG removal intent. This updates validation and serialization so explicit false, explicit null, and omitted values have distinct behavior.
Validation
Allow -CapacityReservationGroupId <id> with -DisableCapacityReservationAssignment:$false.
Reject only non-null CRG ID with -DisableCapacityReservationAssignment:$true.
Use a consistent error message across VM and VMSS paths.
Serialization
Preserve explicit -CapacityReservationGroupId $null as an empty subresource for update removal:
"capacityReservationGroup": {}
Avoid serializing { "id": null }.
Keep omitted CRG ID behavior unchanged.
VMSS update paths
Support -DisableCapacityReservationAssignment through both direct Update-AzVmss and object-based -VirtualMachineScaleSet update flows.
Added focused unit coverage for validation and serialization edge cases.
Updated VM/VMSS scenario coverage, help text, and Compute changelog.
Example:
# Valid: explicit false does not opt outNew-AzVmssConfig`-CapacityReservationGroupId $crgId`-DisableCapacityReservationAssignment:$false# Valid: explicit null removes the existing association on updateUpdate-AzVmss`-ResourceGroupName $rg`-VMScaleSetName $vmss`-CapacityReservationGroupId $null# Invalid: true opt-out conflicts with a non-null CRG IDUpdate-AzVM`-ResourceGroupName $rg`-VM $vm`-CapacityReservationGroupId $crgId`-DisableCapacityReservationAssignment
Verification Checklist
Cmdlet implementation updated with the new/changed parameter(s)
Model class updated to represent the API schema.
Help content regenerated: new parameter appears in the SYNTAX section and in alphabetical order in the PARAMETERS section.
Examples updated to cover the new parameter(s).
If adding a new command, add it to the help/Az.Compute.md file
If adding a new command, register it in Az.Compute.psd1 (CmdletsToExport, alphabetical order).
New scenario tests cover the full matrix: each new parameter exercised alone and in combination, every affected cmdlet, Update merge semantics, removal/disable paths, and negative/edge cases.
Test assertions check concrete sub-properties and re-read the resource with a follow-up Get-* call to confirm values persisted.
Every new .ps1 scenario function is wired into the .cs file as a [Fact] check-in test.
ChangeLog.md updated with a concise, user-focused entry under ## Upcoming Release.
The PR description's Fixes #1577 reference does not match this change: repository item #1577 is the unrelated closed pull request titled Save profile data in home directory. Please replace or remove that closing reference so the capacity-reservation change points to the correct issue.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 PR Validation —⚠️ Review suggested
️✔️Az.Accounts
️✔️Az.KeyVault
️✔️Az.Maintenance
️✔️Az.ManagedServiceIdentity
️✔️Az.Monitor
️✔️Az.Network
️✔️Az.OperationalInsights
️✔️Az.PrivateDns
️✔️Az.RecoveryServices
️✔️Az.ResourceGraph
️✔️Az.Security
️✔️Az.Sql
️✔️Az.Ssh
️✔️Az.Storage
Capacity reservation assignment handling for VM and VMSS cmdlets conflated “parameter bound” with “switch enabled” and could not preserve explicit CRG removal intent. This updates validation and serialization so explicit
false, explicitnull, and omitted values have distinct behavior.Validation
-CapacityReservationGroupId <id>with-DisableCapacityReservationAssignment:$false.-DisableCapacityReservationAssignment:$true.Serialization
-CapacityReservationGroupId $nullas an empty subresource for update removal:"capacityReservationGroup": {}{ "id": null }.VMSS update paths
-DisableCapacityReservationAssignmentthrough both directUpdate-AzVmssand object-based-VirtualMachineScaleSetupdate flows.Coverage and docs
Example:
Verification Checklist
SYNTAXsection and in alphabetical order in thePARAMETERSsection.Az.Compute.psd1(CmdletsToExport, alphabetical order).Get-*call to confirm values persisted..ps1scenario function is wired into the.csfile as a[Fact]check-in test.ChangeLog.mdupdated with a concise, user-focused entry under## Upcoming Release.