Create a snapshot
A snapshot is a full, read-only copy of a virtual hard drive (VHD). You can take a snapshot of an OS or data disk VHD to use as a backup, or to troubleshoot virtual machine (VM) issues.
If you are going to use the snapshot to create a new VM, we recommend that you cleanly shut down the VM before taking a snapshot, to clear out any processes that are in progress.
Use the Azure portal
- Sign in to the Azure portal.
- From the left menu, select Create a resource, and then search for and select snapshot.
- In the Snapshot window, select Create. The Create snapshot window appears.
- Enter a Name for the snapshot.
- Select an existing Resource group or enter the name of 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. Select Standard_HDD, unless you need the snapshot to be stored on a high-performing disk.
- Select Create.
The following steps show how to copy the VHD disk, create the snapshot configuration, and take a snapshot of the disk by using the New-AzSnapshot cmdlet.
This article has been updated to use the new Azure PowerShell Az module. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For installation instructions, see Install Azure PowerShell.
Set some parameters:
$resourceGroupName = 'myResourceGroup' $location = 'eastus' $vmName = 'myVM' $snapshotName = 'mySnapshot'
Get the VM:
$vm = get-azvm ` -ResourceGroupName $resourceGroupName -Name $vmName
Create the snapshot configuration. For this example, the snapshot is of the OS disk:
$snapshot = New-AzSnapshotConfig -SourceUri $vm.StorageProfile.OsDisk.ManagedDisk.Id -Location $location -CreateOption copy
If you would like to store your snapshot in zone-resilient storage, create it in a region that supports availability zones and include the
Take the snapshot:
New-AzSnapshot -Snapshot $snapshot -SnapshotName $snapshotName -ResourceGroupName $resourceGroupName
Create a virtual machine from a snapshot by creating a managed disk from a snapshot and then attaching the new managed disk as the OS disk. For more information, see the sample in Create a VM from a snapshot with PowerShell.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.