Azure PowerShell Modules

Stop-AzVMssVM

Stops a virtual machine scale set virtual machine.

SYNOPSIS

Stop-AzVMssVM
    -ResourceGroupName <String>
    -VMScaleSetName <String>
    -InstanceId <String[]>
    [-Force]
    [-AsJob]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]

DESCRIPTION

The Stop-AzVMssVM cmdlet stops a virtual machine scale set virtual machine. This cmdlet can be used to stop a single virtual machine in a scale set by specifying the instance ID.

PARAMETERS

Name Type Description Required?
-ResourceGroupName String The name of the resource group. Yes
-VMScaleSetName String The name of the virtual machine scale set. Yes
-InstanceId String[] The instance ID of the virtual machine to stop. Yes
-Force Switch Do not ask for confirmation. No
-AsJob Switch Run cmdlet in the background. No
-DefaultProfile IAzureContextContainer The Azure authentication context. No
-WhatIf Switch Shows what would happen if the cmdlet runs. The cmdlet is not run. No
-Confirm Switch Prompts you for confirmation before running the cmdlet. No

EXAMPLES

Example 1: Stop a single VM instance in a scale set

Stop-AzVMssVM -ResourceGroupName "MyResourceGroup" -VMScaleSetName "MyVMSS" -InstanceId "0"

This command stops the virtual machine instance with ID "0" in the virtual machine scale set named "MyVMSS" within the "MyResourceGroup" resource group.

Example 2: Stop multiple VM instances in a scale set

Stop-AzVMssVM -ResourceGroupName "MyResourceGroup" -VMScaleSetName "MyVMSS" -InstanceId "0", "1", "2" -Force

This command stops the virtual machine instances with IDs "0", "1", and "2" in the specified scale set without prompting for confirmation.

NOTES

This cmdlet stops the specified virtual machine instance without deallocating it. To deallocate the VM and stop billing, use the Stop-AzVMssVM cmdlet with the -Force parameter and ensure the scale set is configured to deallocate VMs on stop. For more information, refer to the Azure documentation.

RELATED LINKS