Remove-​Azure​Rm​Vmss

Removes the VMSS or a virtual machine that is within the VMSS.

Syntax

Remove-AzureRmVmss
      [-ResourceGroupName] <String>
      [-VMScaleSetName] <String>
      [[-InstanceId] <String[]>]
      [-Force]
      [-Confirm]
      [-WhatIf]
      [<CommonParameters>]

Description

The Remove-AzureRmVmss cmdlet removes the Virtual Machine Scale Set (VMSS) from Azure. This cmdlet can also be used to remove a specific virtual machine inside the VMSS. You can use the InstanceId parameter to remove a specific virtual machine inside the VMSS.

Examples

Example 1: Remove a VMSS

PS C:\>Remove-AzureRmVmss -ResourceGroupName "Group001" -VMScaleSetName "VMScaleSet001"

This command removes the VMSS named VMScaleSet001 that belongs to the resource group named Group001.

Example 2: Remove a virtual machine from within a VMSS

PS C:\>Remove-AzureRmVmss -ResourceGroupName "Group002" -VMScaleSetName "VMScaleSet002" -InstanceId "3";

This command removes the virtual machine with instance ID 3 from the VMSS named VMScaleSet002 that belongs to the resource group named Group002.

Required Parameters

-ResourceGroupName

Specifies the name of the resource group that the VMSS belongs to.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VMScaleSetName

Species the name of the VMSS that this cmdlet removes. If you specify the InstanceId parameter, the cmdlet will remove the specified virtual machine from the VMSS named by this parameter.

Type:String
Aliases:Name
Position:3
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InstanceId

Specifies, as a string array, the ID of the instances that need to be started. For instance: -InstanceId "0", "3"

Type:String[]
Position:4
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False