Stops a virtual machine.
Stop-AzVM
[-ResourceGroupName] <String>
[-VMName] <String>
[-Force]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
The Stop-AzVM cmdlet stops a virtual machine. This cmdlet deallocates the virtual machine, which means that it is not charged for compute usage when it is stopped.
This cmdlet supports the following parameters: Name, ResourceGroupName.
| Name | Type | Description |
|---|---|---|
| -ResourceGroupName | String | Specifies the name of the resource group that contains the virtual machine. |
| -VMName | String | Specifies the name of the virtual machine to stop. |
| -Force | [Switch] | Forces the command to run without asking for user confirmation. |
| -AsJob | [Switch] | Run cmdlet in the background. |
| -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. |
PS C:\> Stop-AzVM -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine11" -Force
PS C:\> Stop-AzVM -ResourceGroupName "ResourceGroup11" -VMName "VirtualMachine11"
Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine
Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine
To stop a virtual machine and deallocate it, use the -Force parameter.
If you do not deallocate the virtual machine, you will continue to be charged for compute usage.