The Remove-AzVMSS cmdlet deletes a virtual machine scale set (VMSS).
Deletes a virtual machine scale set.
Remove-AzVMSS
[-Name] <System.String>
[-ResourceGroupName] <System.String>
[-Force]
[-AsJob]
[-DefaultProfile] <IAzureContextContainer>
[-WhatIf]
[-Confirm]
Remove-AzVMSS
-InputObject <PSVirtualMachineScaleSet>
[-Force]
[-AsJob]
[-DefaultProfile] <IAzureContextContainer>
[-WhatIf]
[-Confirm]
The Remove-AzVMSS cmdlet deletes a virtual machine scale set (VMSS). You can specify a VMSS by its name and the resource group name. Alternatively, you can use the InputObject parameter to specify a VMSS object.
| Name | Type | Description | Required? |
|---|---|---|---|
| -Name | System.String | Specifies the name of the virtual machine scale set to delete. | True (unless -InputObject is used) |
| -ResourceGroupName | System.String | Specifies the name of the resource group that contains the virtual machine scale set. | True (unless -InputObject is used) |
| -InputObject | Microsoft.Azure.Commands.Compute.VirtualMachineScaleSets.PSVirtualMachineScaleSet | Specifies the virtual machine scale set to delete as a PSVirtualMachineScaleSet object. You can pipe this object to this cmdlet. | True (unless -Name and -ResourceGroupName are used) |
| -Force | System.Management.Automation.SwitchParameter | Ignores confirmation prompts. | False |
| -AsJob | System.Management.Automation.SwitchParameter | Run cmdlet in the background. | False |
| -DefaultProfile | Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer | The credentials, account, tenant, and subscription for the command. | False |
| -WhatIf | System.Management.Automation.SwitchParameter | Shows what would happen if the cmdlet runs. The cmdlet is not run. | False |
| -Confirm | System.Management.Automation.SwitchParameter | Prompts you for confirmation before running the cmdlet. | False |
Remove-AzVMSS -Name "MyVMSS" -ResourceGroupName "MyResourceGroup"
This command deletes the virtual machine scale set named "MyVMSS" in the "MyResourceGroup" resource group.
Get-AzVMSS -Name "MyVMSS" -ResourceGroupName "MyResourceGroup" | Remove-AzVMSS
This command retrieves the virtual machine scale set named "MyVMSS" and pipes it to Remove-AzVMSS to delete it.
Remove-AzVMSS -Name "MyVMSS" -ResourceGroupName "MyResourceGroup" -Force
This command deletes the virtual machine scale set named "MyVMSS" without prompting for confirmation.