From cc779ea0a6b49266be43f7fc19e0746032d65052 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Aug 2026 14:19:34 +0000 Subject: [PATCH 1/3] Initial plan From f7e032a5c046ea0efa17dd8034ee10635ceec6e2 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Aug 2026 14:29:32 +0000 Subject: [PATCH 2/3] Add DisableCapacityReservationAssignment parameter and CapacityReservation VMSS VM properties Co-authored-by: haagha <64601174+haagha@users.noreply.github.com> --- src/Compute/Compute/ChangeLog.md | 2 ++ .../Models/PSVirtualMachineScaleSetVM.cs | 1 + .../PSVirtualMachineScaleSetVMInstanceView.cs | 1 + .../Config/NewAzureRmVmssConfigCommand.cs | 23 +++++++++++++++++++ .../VirtualMachineScaleSetUpdateMethod.cs | 23 +++++++++++++++++++ ...tualMachineScaleSetCreateOrUpdateMethod.cs | 14 +++++++++++ .../VirtualMachineScaleSetStrategy.cs | 12 ++++++---- 7 files changed, 72 insertions(+), 4 deletions(-) diff --git a/src/Compute/Compute/ChangeLog.md b/src/Compute/Compute/ChangeLog.md index c769e9e0c1fa..b5ae0d8a22b7 100644 --- a/src/Compute/Compute/ChangeLog.md +++ b/src/Compute/Compute/ChangeLog.md @@ -21,6 +21,8 @@ --> ## Upcoming Release * Updated ComputeRP-related cmdlets to use API version 2026-04-01, DiskRP-related cmdlets to use API version 2026-03-02, and GalleryRP-related cmdlets to use API version 2025-12-03. +* 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. ## Version 11.8.0 * Deprecated installing the legacy Azure Enhanced Monitoring (AEM) extension for SAP on Virtual Machines (VMs); `Set-AzVMAEMExtension` now installs the new extension by default. diff --git a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs index d4fd2fa86613..f15595f610ac 100644 --- a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs +++ b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVM.cs @@ -67,6 +67,7 @@ public string ResourceGroupName public IDictionary Tags { get; set; } public string UserData { get; set; } public string ResilientVMDeletionStatus { get; set; } + public CapacityReservationProfile CapacityReservation { get; set; } } } diff --git a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVMInstanceView.cs b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVMInstanceView.cs index 4fdf8dcab07d..124cdd9133fa 100644 --- a/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVMInstanceView.cs +++ b/src/Compute/Compute/Generated/Models/PSVirtualMachineScaleSetVMInstanceView.cs @@ -39,6 +39,7 @@ public partial class PSVirtualMachineScaleSetVMInstanceView public IList Statuses { get; set; } public string AssignedHost { get; set; } public string PlacementGroupId { get; set; } + public string CapacityReservationType { get; set; } } } diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs index de0ae150a350..dabe3f9a49e5 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/Config/NewAzureRmVmssConfigCommand.cs @@ -287,6 +287,11 @@ public partial class NewAzureRmVmssConfigCommand : Microsoft.Azure.Commands.Reso [ResourceIdCompleter("Microsoft.Compute/capacityReservationGroups")] public string CapacityReservationGroupId { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "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.")] + public SwitchParameter DisableCapacityReservationAssignment { get; set; } + [Parameter( Mandatory = false, HelpMessage = "UserData for the VM, which will be Base64 encoded. Customer should not pass any secrets in here.", @@ -701,6 +706,24 @@ private void Run() vVirtualMachineProfile.CapacityReservation.CapacityReservationGroup = new SubResource(this.CapacityReservationGroupId); } + if (this.IsParameterBound(c => c.DisableCapacityReservationAssignment)) + { + if (this.IsParameterBound(c => c.CapacityReservationGroupId)) + { + throw new PSArgumentException( + "The -CapacityReservationGroupId and -DisableCapacityReservationAssignment parameters cannot be used together."); + } + if (vVirtualMachineProfile == null) + { + vVirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); + } + if (vVirtualMachineProfile.CapacityReservation == null) + { + vVirtualMachineProfile.CapacityReservation = new CapacityReservationProfile(); + } + vVirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment = this.DisableCapacityReservationAssignment.IsPresent; + } + if (this.IsParameterBound(c => c.AutomaticRepairGracePeriod)) { if (vAutomaticRepairsPolicy == null) diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs index 8139a5e396dc..cf3d9f1316f7 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs @@ -343,6 +343,11 @@ public override void ExecuteCmdlet() [ResourceIdCompleter("Microsoft.Compute/capacityReservationGroups")] public string CapacityReservationGroupId { get; set; } + [Parameter( + Mandatory = false, + HelpMessage = "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.")] + public SwitchParameter DisableCapacityReservationAssignment { get; set; } + [Parameter( Mandatory = false)] [ValidateNotNullOrEmpty] @@ -1678,6 +1683,24 @@ private void BuildPutObject() this.VirtualMachineScaleSet.VirtualMachineProfile.CapacityReservation.CapacityReservationGroup.Id = this.CapacityReservationGroupId; } + if (this.IsParameterBound(c => c.DisableCapacityReservationAssignment)) + { + if (this.IsParameterBound(c => c.CapacityReservationGroupId)) + { + throw new PSArgumentException( + "The -CapacityReservationGroupId and -DisableCapacityReservationAssignment parameters cannot be used together."); + } + if (this.VirtualMachineScaleSet.VirtualMachineProfile == null) + { + this.VirtualMachineScaleSet.VirtualMachineProfile = new PSVirtualMachineScaleSetVMProfile(); + } + if (this.VirtualMachineScaleSet.VirtualMachineProfile.CapacityReservation == null) + { + this.VirtualMachineScaleSet.VirtualMachineProfile.CapacityReservation = new CapacityReservationProfile(); + } + this.VirtualMachineScaleSet.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment = this.DisableCapacityReservationAssignment.IsPresent; + } + if (this.IsParameterBound(c => c.CustomData)) { if (this.VirtualMachineScaleSet.VirtualMachineProfile == null) diff --git a/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs b/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs index 392dd56cf95a..bc782e065887 100644 --- a/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs +++ b/src/Compute/Compute/Manual/VirtualMachineScaleSetCreateOrUpdateMethod.cs @@ -213,6 +213,12 @@ public partial class NewAzureRmVmss : ComputeAutomationBaseCmdlet [ResourceIdCompleter("Microsoft.Compute/capacityReservationGroups")] public string CapacityReservationGroupId { get; set; } + [Parameter( + Mandatory = false, + ParameterSetName = SimpleParameterSet, + HelpMessage = "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.")] + public SwitchParameter DisableCapacityReservationAssignment { get; set; } + [Parameter( Mandatory = false, ParameterSetName = SimpleParameterSet, @@ -597,6 +603,7 @@ private async Task> SimpleParameterSetNor edgeZone: _cmdlet.EdgeZone, orchestrationMode: _cmdlet.IsParameterBound(c => c.OrchestrationMode) ? _cmdlet.OrchestrationMode : null, capacityReservationId: _cmdlet.IsParameterBound(c => c.CapacityReservationGroupId) ? _cmdlet.CapacityReservationGroupId : null, + disableCapacityReservationAssignment: _cmdlet.IsParameterBound(c => c.DisableCapacityReservationAssignment) ? _cmdlet.DisableCapacityReservationAssignment.IsPresent : (bool?)null, userData: _cmdlet.IsParameterBound(c => c.UserData) ? _cmdlet.UserData : null, imageReferenceId: _cmdlet.IsParameterBound(c => c.ImageReferenceId) ? _cmdlet.ImageReferenceId : null, auxAuthHeader: auxAuthHeader, @@ -748,6 +755,7 @@ private async Task> SimpleParameterSetOrc edgeZone: _cmdlet.EdgeZone, orchestrationMode: OrchestrationModes.Flexible, capacityReservationId: _cmdlet.IsParameterBound(c => c.CapacityReservationGroupId) ? _cmdlet.CapacityReservationGroupId : null, + disableCapacityReservationAssignment: _cmdlet.IsParameterBound(c => c.DisableCapacityReservationAssignment) ? _cmdlet.DisableCapacityReservationAssignment.IsPresent : (bool?)null, securityType: _cmdlet.SecurityType, enableVtpm: _cmdlet.EnableVtpm, enableSecureBoot: _cmdlet.EnableSecureBoot, @@ -774,6 +782,12 @@ private async Task> SimpleParameterSetOrc async Task SimpleParameterSetExecuteCmdlet(IAsyncCmdlet asyncCmdlet) { + if (this.IsParameterBound(c => c.DisableCapacityReservationAssignment) && this.IsParameterBound(c => c.CapacityReservationGroupId)) + { + throw new PSArgumentException( + "The -CapacityReservationGroupId and -DisableCapacityReservationAssignment parameters cannot be used together."); + } + bool loadBalancerNamePassedIn = !String.IsNullOrWhiteSpace(LoadBalancerName); ResourceGroupName = ResourceGroupName ?? VMScaleSetName; diff --git a/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs b/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs index 3d649a947ae1..bd4d387a6f78 100644 --- a/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs +++ b/src/Compute/Compute/Strategies/ComputeRp/VirtualMachineScaleSetStrategy.cs @@ -68,6 +68,7 @@ internal static ResourceConfig CreateVirtualMachineScale string edgeZone, string orchestrationMode, string capacityReservationId, + bool? disableCapacityReservationAssignment, string userData, string imageReferenceId, Dictionary> auxAuthHeader, @@ -184,9 +185,10 @@ internal static ResourceConfig CreateVirtualMachineScale Priority = priority, EvictionPolicy = evictionPolicy, BillingProfile = (maxPrice == null) ? null : new BillingProfile(maxPrice), - CapacityReservation = (capacityReservationId == null) ? null : new CapacityReservationProfile + CapacityReservation = (capacityReservationId == null && disableCapacityReservationAssignment == null) ? null : new CapacityReservationProfile { - CapacityReservationGroup = new Microsoft.Azure.Management.Compute.Models.SubResource(capacityReservationId) + CapacityReservationGroup = (capacityReservationId == null) ? null : new Microsoft.Azure.Management.Compute.Models.SubResource(capacityReservationId), + DisableCapacityReservationAssignment = disableCapacityReservationAssignment }, UserData = userData, SecurityPostureReference = (securityPostureId != null || securityPostureExcludeExtension != null) ? new SecurityPostureReference @@ -269,6 +271,7 @@ internal static ResourceConfig CreateVirtualMachineScale string edgeZone, string orchestrationMode, string capacityReservationId, + bool? disableCapacityReservationAssignment, Dictionary> auxAuthHeader, bool? enableVtpm = null, bool? enableSecureBoot = null, @@ -365,9 +368,10 @@ internal static ResourceConfig CreateVirtualMachineScale Priority = priority, EvictionPolicy = evictionPolicy, BillingProfile = (maxPrice == null) ? null : new BillingProfile(maxPrice), - CapacityReservation = (capacityReservationId == null) ? null : new CapacityReservationProfile + CapacityReservation = (capacityReservationId == null && disableCapacityReservationAssignment == null) ? null : new CapacityReservationProfile { - CapacityReservationGroup = new Microsoft.Azure.Management.Compute.Models.SubResource(capacityReservationId) + CapacityReservationGroup = (capacityReservationId == null) ? null : new Microsoft.Azure.Management.Compute.Models.SubResource(capacityReservationId), + DisableCapacityReservationAssignment = disableCapacityReservationAssignment }, SecurityPostureReference = (securityPostureId != null || securityPostureExcludeExtension != null) ? new SecurityPostureReference { From bc2a1fe67e9d8a5f416c2e5152048ae2f1a23fa6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 14 Aug 2026 14:35:58 +0000 Subject: [PATCH 3/3] Guard DisableCapacityReservationAssignment on Update-AzVmss PATCH path; update tests and help Co-authored-by: haagha <64601174+haagha@users.noreply.github.com> --- .../ScenarioTests/StrategiesVmssTests.cs | 7 ++ .../ScenarioTests/StrategiesVmssTests.ps1 | 77 +++++++++++++++++++ .../VirtualMachineScaleSetUpdateMethod.cs | 12 ++- src/Compute/Compute/help/New-AzVmss.md | 18 ++++- src/Compute/Compute/help/New-AzVmssConfig.md | 19 ++++- src/Compute/Compute/help/Update-AzVmss.md | 21 ++++- 6 files changed, 148 insertions(+), 6 deletions(-) diff --git a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs index b2a65d261f43..69ac597b476e 100644 --- a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs +++ b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.cs @@ -179,5 +179,12 @@ public void TestVmssLifecycleHookEventEndToEnd() { TestRunner.RunTestScript("Test-VmssLifecycleHookEventEndToEnd"); } + + [Fact] + [Trait(Category.AcceptanceType, Category.CheckIn)] + public void TestVmssDisableCapacityReservationAssignment() + { + TestRunner.RunTestScript("Test-VmssDisableCapacityReservationAssignment"); + } } } diff --git a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 index d3a45c405300..17e1eb323372 100644 --- a/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 +++ b/src/Compute/Compute.Test/ScenarioTests/StrategiesVmssTests.ps1 @@ -928,3 +928,80 @@ function Test-VmssLifecycleHookEventEndToEnd Clean-ResourceGroup $rgname } } + +<# +.SYNOPSIS +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. +#> +function Test-VmssDisableCapacityReservationAssignment +{ + # Setup + $vmssname = Get-ResourceName + $loc = Get-ComputeVMLocation + + try + { + $username = "admin01" + $password = Get-PasswordForVM | ConvertTo-SecureString -AsPlainText -Force + $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password + [string]$domainNameLabel = "$vmssname$vmssname".tolower(); + + # Step 1: Simple parameter set - New-AzVmss with -DisableCapacityReservationAssignment directly. + $vmss = New-AzVmss -ResourceGroupName $vmssname -Name $vmssname -Location $loc -Credential $cred ` + -DomainNameLabel $domainNameLabel -DisableCapacityReservationAssignment; + Assert-NotNull $vmss.VirtualMachineProfile.CapacityReservation; + Assert-True { $vmss.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment }; + Assert-Null $vmss.VirtualMachineProfile.CapacityReservation.CapacityReservationGroup; + + # Re-read the VMSS to confirm the setting persisted server-side. + $vmss = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Assert-True { $vmss.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment }; + + # Step 2: Verify the VMSS VM (Get-AzVmssVM) surfaces the inherited CapacityReservation property. + $vms = Get-AzVmssVM -ResourceGroupName $vmssname -VMScaleSetName $vmssname; + Assert-True { @($vms).Count -gt 0 }; + $vm = @($vms)[0]; + Assert-NotNull $vm.CapacityReservation; + Assert-True { $vm.CapacityReservation.DisableCapacityReservationAssignment }; + + # Verify the instance view surfaces CapacityReservationType. + $vmInstanceView = Get-AzVmssVM -ResourceGroupName $vmssname -VMScaleSetName $vmssname -InstanceId $vm.InstanceId -InstanceView; + Assert-NotNull $vmInstanceView.CapacityReservationType; + + # Step 3: Update-AzVmss - toggle DisableCapacityReservationAssignment off, then back on via the PUT path + # (-VirtualMachineScaleSet), and verify merge semantics (other settings on the VMSS remain unaffected). + $current = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Update-AzVmss -ResourceGroupName $vmssname -VMScaleSetName $vmssname -VirtualMachineScaleSet $current -DisableCapacityReservationAssignment:$false; + $vmss = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Assert-False { $vmss.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment }; + + $current = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Update-AzVmss -ResourceGroupName $vmssname -VMScaleSetName $vmssname -VirtualMachineScaleSet $current -DisableCapacityReservationAssignment; + $vmss = Get-AzVmss -ResourceGroupName $vmssname -Name $vmssname; + Assert-True { $vmss.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment }; + + # Step 4: New-AzVmssConfig + New-AzVmss pipeline scenario. + $vmssConfig = New-AzVmssConfig -Location $loc -SkuCapacity 1 -SkuName "Standard_DS1_v2" -UpgradePolicyMode "Manual" ` + -DisableCapacityReservationAssignment; + Assert-NotNull $vmssConfig.VirtualMachineProfile.CapacityReservation; + Assert-True { $vmssConfig.VirtualMachineProfile.CapacityReservation.DisableCapacityReservationAssignment }; + + # Step 5: Negative test - -CapacityReservationGroupId and -DisableCapacityReservationAssignment are mutually exclusive. + Assert-ThrowsContains { New-AzVmssConfig -Location $loc -CapacityReservationGroupId "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/capacityReservationGroups/crg" -DisableCapacityReservationAssignment } ` + "cannot be used together"; + Assert-ThrowsContains { Update-AzVmss -ResourceGroupName $vmssname -VMScaleSetName $vmssname -VirtualMachineScaleSet $current -CapacityReservationGroupId "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Compute/capacityReservationGroups/crg" -DisableCapacityReservationAssignment } ` + "cannot be used together"; + + # Negative: PATCH path (no -VirtualMachineScaleSet) must reject -DisableCapacityReservationAssignment. + Assert-ThrowsContains { Update-AzVmss -ResourceGroupName $vmssname -VMScaleSetName $vmssname -DisableCapacityReservationAssignment } ` + "CreateOrUpdate path"; + } + finally + { + # Cleanup + Clean-ResourceGroup $vmssname + } +} diff --git a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs index cf3d9f1316f7..57ed1ce2df20 100644 --- a/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs +++ b/src/Compute/Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetUpdateMethod.cs @@ -345,7 +345,7 @@ public override void ExecuteCmdlet() [Parameter( Mandatory = false, - HelpMessage = "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.")] + HelpMessage = "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).")] public SwitchParameter DisableCapacityReservationAssignment { get; set; } [Parameter( @@ -1607,6 +1607,16 @@ void InitializeZoneAllocationPolicy() "Provide a VirtualMachineScaleSet object via -VirtualMachineScaleSet parameter (e.g., pipe the output of 'Get-AzVmss') when configuring Scheduled Events."); } + // CapacityReservation is not supported in VirtualMachineScaleSetUpdate (PATCH) model. + // When using the PATCH path (VirtualMachineScaleSet is null), DisableCapacityReservationAssignment + // is not applied and is therefore rejected at runtime. + if (this.IsParameterBound(c => c.DisableCapacityReservationAssignment)) + { + throw new PSArgumentException( + "The -DisableCapacityReservationAssignment parameter is only supported when updating a Virtual Machine Scale Set using the CreateOrUpdate path. " + + "Provide a VirtualMachineScaleSet object via -VirtualMachineScaleSet parameter (e.g., pipe the output of 'Get-AzVmss') when configuring capacity reservation."); + } + if (this.IsParameterBound(c => c.ZonalPlatformFaultDomainAlignMode)) { if (this.VirtualMachineScaleSetUpdate == null) diff --git a/src/Compute/Compute/help/New-AzVmss.md b/src/Compute/Compute/help/New-AzVmss.md index 998ec6ebc651..bc730578a09e 100644 --- a/src/Compute/Compute/help/New-AzVmss.md +++ b/src/Compute/Compute/help/New-AzVmss.md @@ -35,7 +35,8 @@ New-AzVmss [[-ResourceGroupName] ] [-VMScaleSetName] [-AsJob] [ [-DataDiskSizeInGb ] [-ProximityPlacementGroupId ] [-HostGroupId ] [-Priority ] [-EvictionPolicy ] [-MaxPrice ] [-ScaleInPolicy ] [-SkipExtensionsOnOverprovisionedVMs] [-EncryptionAtHost] [-PlatformFaultDomainCount ] - [-OrchestrationMode ] [-CapacityReservationGroupId ] [-ImageReferenceId ] + [-OrchestrationMode ] [-CapacityReservationGroupId ] + [-DisableCapacityReservationAssignment] [-ImageReferenceId ] [-DiskControllerType ] [-SharedGalleryImageId ] [-SecurityType ] [-EnableVtpm ] [-EnableSecureBoot ] [-SecurityPostureId ] [-SecurityPostureExcludeExtension ] [-SkuProfileVmSize ] @@ -440,6 +441,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DisableCapacityReservationAssignment +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. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -DiskControllerType Specifies the disk controller type configured for the VM and VirtualMachineScaleSet. This property is only supported for virtual machines whose operating system disk and VM sku supports Generation 2 (https://learn.microsoft.com/en-us/azure/virtual-machines/generation-2), please check the HyperVGenerations capability returned as part of VM sku capabilities in the response of Microsoft.Compute SKUs api for the region contains V2 (https://learn.microsoft.com/rest/api/compute/resourceskus/list) .
For more information about Disk Controller Types supported please refer to https://aka.ms/azure-diskcontrollertypes. diff --git a/src/Compute/Compute/help/New-AzVmssConfig.md b/src/Compute/Compute/help/New-AzVmssConfig.md index 823d88c16252..066019566bf0 100644 --- a/src/Compute/Compute/help/New-AzVmssConfig.md +++ b/src/Compute/Compute/help/New-AzVmssConfig.md @@ -28,7 +28,7 @@ New-AzVmssConfig [[-Overprovision] ] [[-Location] ] [-EdgeZone [-SpotRestoreTimeout ] [-EvictionPolicy ] [-MaxPrice ] [-TerminateScheduledEvents] [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-ProximityPlacementGroupId ] [-ScaleInPolicy ] [-EncryptionAtHost] [-OrchestrationMode ] - [-CapacityReservationGroupId ] [-UserData ] [-AutomaticRepairAction ] + [-CapacityReservationGroupId ] [-DisableCapacityReservationAssignment] [-UserData ] [-AutomaticRepairAction ] [-BaseRegularPriorityCount ] [-RegularPriorityPercentage ] [-ImageReferenceId ] [-SharedGalleryImageId ] [-OSImageScheduledEventEnabled] [-OSImageScheduledEventNotBeforeTimeoutInMinutes ] [-SecurityType ] [-EnableVtpm ] @@ -57,7 +57,7 @@ New-AzVmssConfig [[-Overprovision] ] [[-Location] ] [-EdgeZone [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-ProximityPlacementGroupId ] [-ScaleInPolicy ] -IdentityType [-IdentityId ] [-EncryptionIdentity ] [-EncryptionAtHost] [-OrchestrationMode ] - [-CapacityReservationGroupId ] [-UserData ] [-AutomaticRepairAction ] + [-CapacityReservationGroupId ] [-DisableCapacityReservationAssignment] [-UserData ] [-AutomaticRepairAction ] [-BaseRegularPriorityCount ] [-RegularPriorityPercentage ] [-ImageReferenceId ] [-SharedGalleryImageId ] [-OSImageScheduledEventEnabled] [-OSImageScheduledEventNotBeforeTimeoutInMinutes ] [-SecurityType ] [-EnableVtpm ] @@ -362,6 +362,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DisableCapacityReservationAssignment +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. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -EdgeZone Sets the edge zone name. If set, the query will be routed to the specified edgezone instead of the main region. diff --git a/src/Compute/Compute/help/Update-AzVmss.md b/src/Compute/Compute/help/Update-AzVmss.md index 2fe9434df827..bbd90bf494b5 100644 --- a/src/Compute/Compute/help/Update-AzVmss.md +++ b/src/Compute/Compute/help/Update-AzVmss.md @@ -31,7 +31,8 @@ Update-AzVmss [-ResourceGroupName] [-VMScaleSetName] [-SkipExtensionsOnOverprovisionedVMs ] [-SkuCapacity ] [-SkuName ] [-SkuTier ] [-Tag ] [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-TerminateScheduledEvents ] [-TimeZone ] [-UltraSSDEnabled ] - [-UpgradePolicyMode ] [-CapacityReservationGroupId ] [-VhdContainer ] [-AsJob] + [-UpgradePolicyMode ] [-CapacityReservationGroupId ] + [-DisableCapacityReservationAssignment] [-VhdContainer ] [-AsJob] [-EncryptionAtHost ] [-UserData ] [-BaseRegularPriorityCount ] [-RegularPriorityPercentage ] [-SharedGalleryImageId ] [-OSImageScheduledEventEnabled] [-OSImageScheduledEventNotBeforeTimeoutInMinutes ] [-SecurityType ] [-EnableVtpm ] @@ -64,7 +65,8 @@ Update-AzVmss [-ResourceGroupName] [-VMScaleSetName] [-SkipExtensionsOnOverprovisionedVMs ] [-SkuCapacity ] [-SkuName ] [-SkuTier ] [-Tag ] [-TerminateScheduledEventNotBeforeTimeoutInMinutes ] [-TerminateScheduledEvents ] [-TimeZone ] [-UltraSSDEnabled ] - [-UpgradePolicyMode ] [-CapacityReservationGroupId ] [-VhdContainer ] [-AsJob] + [-UpgradePolicyMode ] [-CapacityReservationGroupId ] + [-DisableCapacityReservationAssignment] [-VhdContainer ] [-AsJob] [-EncryptionAtHost ] [-UserData ] [-BaseRegularPriorityCount ] [-RegularPriorityPercentage ] [-SharedGalleryImageId ] [-OSImageScheduledEventEnabled] [-OSImageScheduledEventNotBeforeTimeoutInMinutes ] [-SecurityType ] [-EnableVtpm ] @@ -302,6 +304,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -DisableCapacityReservationAssignment +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`). + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -DisablePasswordAuthentication Indicates that this cmdlet disables password authentication for Linux OS.