Applies to: ✔️ Linux VMs ✔️ Windows VMs ✔️ Flexible scale sets
A snapshot is a full, read-only copy of a virtual hard disk (VHD). You can use a snapshot as a point-in-time backup, or to help troubleshoot virtual machine (VM) issues. You can take a snapshot of both operating system (OS) or data disk VHDs.
Create a snapshot of a VHD
If you want to use a snapshot to create a new VM, ensure that you first cleanly shut down the VM. This action clears any processes that are in progress.
In the Snapshot window, select Create. The Create snapshot window appears.
For Resource group, select an existing resource group or enter the name of a new one.
Enter a Name, then select a Region and Snapshot type for the new snapshot. If you would like to store your snapshot in zone-resilient storage, you need to select a region that supports availability zones. For a list of supporting regions, see Azure regions with availability zones.
For Source subscription, select the subscription that contains the managed disk to be backed up.
For Source disk, select the managed disk to snapshot.
For Storage type, select Standard HDD, unless you require zone-redundant storage or high-performance storage for your snapshot.
If needed, configure settings on the Encryption, Networking, and Tags tabs. Otherwise, default settings are used for your snapshot.
Follow these steps to take a snapshot with the New-AzSnapshotConfig and New-AzSnapshot cmdlets. This example assumes that you have a VM called myVM in the myResourceGroup resource group. The code sample provided creates a snapshot in the same resource group and within the same region as your source VM.
First, you'll use the New-AzSnapshotConfig cmdlet to create a configurable snapshot object. You can then use the New-AzSnapshot cmdlet to take a snapshot of the disk.
Set the required parameters. Update the values to reflect your environment.
Create the snapshot configuration. In the example, the snapshot is of the OS disk. By default, the snapshot uses locally redundant standard storage. We recommend that you store your snapshots in standard storage instead of premium storage whatever the storage type of the parent disk or target disk. Premium snapshots incur additional cost.
If you want to store your snapshot in zone-resilient storage, you must create the snapshot in a region that supports availability zones and include the -SkuName Standard_ZRS parameter. For a list of regions that support availability zones, see Azure regions with availability zones.
Follow these steps to take a snapshot with the az snapshot create command and the --source-disk parameter. This example assumes that you have a VM called myVM in the myResourceGroup resource group. The code sample provided creates a snapshot in the same resource group and within the same region as your source VM.
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. In the example, the snapshot is of the OS disk. By default, the snapshot uses locally redundant standard storage. We recommend that you store your snapshots in standard storage instead of premium storage whatever the storage type of the parent disk or target disk. Premium snapshots incur additional cost.
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 optional --sku Standard_ZRS parameter. A list of availability zones can be found here.
To recover using a snapshot, you must create a new disk from the snapshot, then either deploy a new VM, and use the managed disk as the OS disk, or attach the disk as a data disk to an existing VM.