Skip to content

Commit

Permalink
hibernate parameter for Stop-AzVmss (#22560)
Browse files Browse the repository at this point in the history
Co-authored-by: Theodore Chang <[email protected]>
  • Loading branch information
grizzlytheodore and Theodore Chang authored Aug 14, 2023
1 parent cfd681c commit d33f542
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Compute/Compute/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
-->
## Upcoming Release
* Added `-Hibernate` switch parameter to `Stop-AzVmss` default parameter set.
* For `Get-AzVmRunCommand`, a bug is fixed to work when returning a list of RunCommands [#22403]
* Updated Azure.Core to 1.34.0.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ public override void ExecuteCmdlet()
}
else
{
result = VirtualMachineScaleSetsClient.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, instanceIds).GetAwaiter().GetResult();
bool? hibernate = this.Hibernate.IsPresent ? (bool?)true : null;
result = VirtualMachineScaleSetsClient.DeallocateWithHttpMessagesAsync(resourceGroupName, vmScaleSetName, hibernate, instanceIds).GetAwaiter().GetResult();
}

PSOperationStatusResponse output = new PSOperationStatusResponse
Expand Down Expand Up @@ -129,5 +130,11 @@ public override void ExecuteCmdlet()

[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]
public SwitchParameter AsJob { get; set; }

[Parameter(
Mandatory = false,
ParameterSetName = "DefaultParameter",
HelpMessage = "Hibernate a virtual machine from the VM scale set. This feature is available for VMSS with Flexible OrchestrationMode only.")]
public SwitchParameter Hibernate { get; set; }
}
}
17 changes: 16 additions & 1 deletion src/Compute/Compute/help/Stop-AzVmss.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Stops the VMSS or a set of virtual machines within the VMSS.
### DefaultParameter (Default)
```
Stop-AzVmss [-ResourceGroupName] <String> [-VMScaleSetName] <String> [[-InstanceId] <String[]>] [-Force]
[-AsJob] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
[-AsJob] [-Hibernate] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### FriendMethod
Expand Down Expand Up @@ -93,6 +93,21 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -Hibernate
Hibernate a virtual machine from the VM scale set. This feature is available for VMSS with Flexible OrchestrationMode only.
```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: DefaultParameter
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -InstanceId
Specifies, as a string array, the ID or IDs of the virtual machine instances that this cmdlet stops.
For instance: `-InstanceId "0", "3"`.
Expand Down

0 comments on commit d33f542

Please sign in to comment.