Stop, Deallocate, or Delete a VM in Azure
- Stop a VM
- You can stop a VM from inside of the virtual machine or using an Azure CLI command, such as azure vm stop. This stops the guest operating system, but keeps the compute resources. You will continue to be charged for the VM compute resources by the hour.
- Deallocate a VM
- You can deallocate a VM using the Azure portal by clicking Stop which actually stops and deallocates the VM. You can also deallocate a VM using an Azure CLI command, such as azure vm deallocate. Deallocating will stop the VM and release all the compute resources so you are no longer charged for the VM compute resources. However, all persistent disks remain, such as the operating system disk and the attached data disks. The VM can be restarted from the Azure portal. When you deallocate a VM, the data on the temporary/ephemeral local SSD is lost and cannot be recovered.
- Delete a VM
You can delete a VM by either deleting the VM or the resource group in which the VM is contained from using the Azure portal or an Azure CLI command, such as azure vm delete. If the storage account that was used for the operating system and data disks is also deleted, which happens when the whole resource group is deleted, the persistent disks are deleted with it. If you delete only the VM itself, the disks remain in storage and can be attached to another VM that is created in the same region.