Stop-AzVM
Stop a virtual machine.
Syntax
Stop-AzVM [-ResourceGroupName][-Name] [-Force] [-AsJob] [-WhatIf] [-Confirm] [ ]
Description
The Stop-AzVM cmdlet stops a virtual machine. You can optionally deallocate the virtual machine to stop billing for its compute resources.
Parameters
| Name | Type | Description |
|---|---|---|
-ResourceGroupName |
String | Specifies the name of the resource group for the virtual machine. |
-Name |
String | Specifies the name of the virtual machine. |
-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. |
Examples
Example 1: Stop a virtual machine
Stop-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine11"
This command stops the virtual machine named VirtualMachine11 in the resource group ResourceGroup11.
Example 2: Stop and deallocate a virtual machine
Stop-AzVM -ResourceGroupName "ResourceGroup11" -Name "VirtualMachine11" -Force
This command stops and deallocates the virtual machine named VirtualMachine11 in the resource group ResourceGroup11. The -Force parameter is used to skip the confirmation prompt.
Notes
Important: Stopping a virtual machine without deallocating it will continue to incur charges for storage and reserved instance resources. Deallocating releases the compute resources and stops these charges.