Create a snapshot
Take a snapshot of an OS or data disk for backup or to troubleshoot VM issues. A snapshot is a full, read-only copy of a VHD.
Use Azure CLI
The following example requires the Azure CLI 2.0 installed and logged into your Azure account. Run
az --version to find the version. If you need to install or upgrade, see Install Azure CLI 2.0.
The following steps show how to take a snapshot using the
az snapshot create command with the
--source-disk parameter. The following example assumes that there is a VM called
myVM in the
myResourceGroup resource group.
Get the disk ID.
osDiskId=$(az vm show -g myResourceGroup -n myVM --query "storageProfile.osDisk.managedDisk.id" -o tsv)
Take a snapshot named osDisk-backup.
az snapshot create \ -g myResourceGroup \ --source "$osDiskId" \ --name osDisk-backup
If you would like to store your snapshot in zone-resilient storage, you need to create it in a region that supports availability zones and include the
--sku Standard_ZRS parameter.
Use Azure portal
- Sign in to the Azure portal.
- Starting in the upper-left, click Create a resource and search for snapshot.
- In the Snapshot blade, click Create.
- Enter a Name for the snapshot.
- Select an existing Resource group or type the name for a new one.
- Select an Azure datacenter Location.
- For Source disk, select the Managed Disk to snapshot.
- Select the Account type to use to store the snapshot. We recommend Standard_LRS unless you need it stored on a high performing disk.
- Click Create.
Create a virtual machine from a snapshot by creating a managed disk from the snapshot and then attaching the new managed disk as the OS disk. For more information, see the Create a VM from a snapshot script.