Restart-AzVmss

Restart-AzVmss

Restarts all virtual machine scale set (VMSS) instances or a specified range of instances.

Syntax

Restart-AzVmss
   [-ResourceGroupName] <String>
   [-VMScaleSetName] <String>
   [[-InstanceId] <String[]>]
   [-AsJob]
   [-Force]
   [-WhatIf]
   [-Confirm]
   [ <CommonParameters> ]

Parameters

Parameter Description
-ResourceGroupName The name of the resource group.
-VMScaleSetName The name of the virtual machine scale set.
-InstanceId The instance ID(s) of the virtual machine scale set instances to restart. If not specified, all instances are restarted.
-AsJob Run cmdlet in the background.
-Force Forces the command to run without asking for user confirmation.
-WhatIf Shows what would happen if the cmdlet runs. The cmdlet is not run.
-Confirm Prompts you for confirmation before running the cmdlet.

Examples

Example 1: Restart all VMSS instances

This command restarts all virtual machine scale set instances in the specified resource group and scale set.

Restart-AzVmss -ResourceGroupName "MyResourceGroup" -VMScaleSetName "MyVMScaleSet"

Example 2: Restart specific VMSS instances

This command restarts instances with IDs 0 and 1 for the specified virtual machine scale set.

Restart-AzVmss -ResourceGroupName "MyResourceGroup" -VMScaleSetName "MyVMScaleSet" -InstanceId "0", "1"

Example 3: Restart VMSS instances as a background job

This command restarts all virtual machine scale set instances in the specified resource group and scale set, running the operation in the background.

Restart-AzVmss -ResourceGroupName "MyResourceGroup" -VMScaleSetName "MyVMScaleSet" -AsJob