Start and Stop Virtual Machines
You can start, stop, deallocate, or restart a virtual machine using the Azure portal, Azure CLI, or Azure PowerShell. Stopping (deallocating) a VM releases the compute resources and stops billing for compute.
Azure Portal
- Navigate to Virtual machines in the Azure portal.
- Select the VM you want to manage.
- Use the Start, Stop, Restart or Deallocate buttons at the top.
Azure CLI
Run the following commands in your terminal. az login first if you haven't authenticated.
# Start a VM
az vm start --resource-group MyResourceGroup --name MyVM
# Stop (deallocate) a VM
az vm deallocate --resource-group MyResourceGroup --name MyVM
# Restart a VM
az vm restart --resource-group MyResourceGroup --name MyVM
Azure PowerShell
# Start a VM
Start-AzVM -ResourceGroupName "MyResourceGroup" -Name "MyVM"
# Stop (deallocate) a VM
Stop-AzVM -ResourceGroupName "MyResourceGroup" -Name "MyVM" -Force
# Restart a VM
Restart-AzVM -ResourceGroupName "MyResourceGroup" -Name "MyVM"
Resize a Virtual Machine
Resize the VM to change its CPU, memory, or pricing tier.
CLI Example
# List available sizes
az vm list-sizes --location eastus
# Resize VM
az vm resize --resource-group MyResourceGroup --name MyVM --size Standard_DS3_v2
Best Practices
| Scenario | Recommendation |
|---|---|
| Development/Test | Stop and deallocate when not in use to reduce costs. |
| Production | Use scheduled start/stop automation for off‑hours. |
| Scaling | Resize based on performance metrics from Azure Monitor. |