This cmdlet deletes a virtual machine (VM).
Deletes a virtual machine.
Remove-AzVM
    [-Name] <String>
    [-ResourceGroupName] <String>
    [-Force]
    [-AsJob]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]The Remove-AzVM cmdlet deletes a virtual machine (VM). You can delete a VM by specifying its name and the resource group name.
This operation is asynchronous and returns immediately. The VM will be deleted in the background.
| Name | Type | Description | 
|---|---|---|
| -Name | String | Specifies the name of the virtual machine to delete. | 
| -ResourceGroupName | String | Specifies the name of the resource group that contains the virtual machine. | 
| -Force | Switch | Forces the command to run without asking for user confirmation. | 
| -AsJob | Switch | Runs the cmdlet as a background job. Use this parameter to run the cmdlet while receiving and processing other messages from the Windows PowerShell session. | 
| -WhatIf | Switch | Shows what would happen if the cmdlet runs. The cmdlet is not run. | 
| -Confirm | Switch | Prompts you for confirmation before running the cmdlet. | 
| <CommonParameters> | Object | This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters. | 
This command deletes the virtual machine named "MyVM" from the resource group named "MyResourceGroup".
Remove-AzVM -Name "MyVM" -ResourceGroupName "MyResourceGroup"This command deletes the virtual machine named "MyVM" from the resource group named "MyResourceGroup" without prompting for confirmation.
Remove-AzVM -Name "MyVM" -ResourceGroupName "MyResourceGroup" -ForceThis command gets the virtual machine object named "MyVM" from the resource group "MyResourceGroup" and pipes it to Remove-AzVM.
Get-AzVM -Name "MyVM" -ResourceGroupName "MyResourceGroup" | Remove-AzVM