Take a snapshot of a Managed Disk for backup or create a Managed Disk from the snapshot and attach it to a test virtual machine to troubleshoot. A Managed Snapshot is a full point-in-time copy of a VM Managed Disk. It creates a read-only copy of your VHD and, by default, stores it as a Standard Managed Disk. For more information about Managed Disks, see Azure Managed Disks overview
For information about pricing, see Azure Storage Pricing.
Before you begin
If you use PowerShell, make sure that you have the latest version of the AzureRM.Compute PowerShell module. Run the following command to install it.
Install-Module AzureRM.Compute -RequiredVersion 2.6.0
For more information, see Azure PowerShell Versioning.
Copy the VHD with a snapshot
Use either the Azure portal or PowerShell to take a snapshot of the Managed Disk.
Use Azure portal to take a snapshot
- Sign in to the Azure portal.
- Starting in the upper left, click New 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.
Use PowerShell to take a snapshot
The following steps show you how to get the VHD disk to be copied, create the snapshot configurations, and take a snapshot of the disk by using the New-AzureRmSnapshot cmdlet.
Set some parameters.
$resourceGroupName = 'myResourceGroup' $location = 'southeastasia' $dataDiskName = 'ContosoMD_datadisk1' $snapshotName = 'ContosoMD_datadisk1_snapshot1'
Replace the parameter values:
- "myResourceGroup" with the VM's resource group.
- "southeastasia" with the geographic location where you want your Managed Snapshot stored.
- "ContosoMD_datadisk1" with the name of the VHD disk that you want to copy.
- "ContosoMD_datadisk1_snapshot1" with the name you want to use for the new snapshot.
Get the VHD disk to be copied.
$disk = Get-AzureRmDisk -ResourceGroupName $resourceGroupName -DiskName $dataDiskName
Create the snapshot configurations.
$snapshot = New-AzureRmSnapshotConfig -SourceUri $disk.Id -CreateOption Copy -Location $location
Take the snapshot.
New-AzureRmSnapshot -Snapshot $snapshot -SnapshotName $snapshotName -ResourceGroupName $resourceGroupName
If you plan to use the snapshot to create a Managed Disk and attach it a VM that needs to be high performing, use the parameter
-AccountType Premium_LRSwith the New-AzureRmSnapshot command. The parameter creates the snapshot so that it's stored as a Premium Managed Disk. Premium Managed Disks are more expensive than Standard. So be sure you really need Premium before using that parameter.