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 that you use Cloud Shell or have the Azure CLI installed.
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 using az vm show.
osDiskId=$(az vm show \ -g myResourceGroup \ -n myVM \ --query "storageProfile.osDisk.managedDisk.id" \ -o tsv)
Take a snapshot named osDisk-backup using az snapshot create.
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.
You can see a list of the snapshots using az snapshot list.
az snapshot list \ -g myResourceGroup \ - table
Use Azure portal
- Sign in to the Azure portal.
- Starting in the upper-left, click Create a resource and search for snapshot. Select Snapshot from the search results.
- 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.
- For Source disk, select the managed disk to snapshot.
- Select the Account type to use to store the snapshot. Use Standard HDD unless you need it stored on a high performing SSD.
- 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.
Send feedback about: