Azure Virtual Machine Snapshots

Learn about creating and managing snapshots of Azure managed disks. Snapshots are point-in-time copies of your data that can be used for backup, restore, or disaster recovery scenarios.

What are Azure VM Snapshots?

An Azure snapshot is a full, read-only copy of a managed disk at a specific point in time. Snapshots are stored as managed snapshots, which are managed by Azure and stored redundantly in a managed storage account. They are ideal for:

Types of Snapshots

Azure offers two primary types of snapshots for managed disks:

Creating a Snapshot

You can create snapshots using the Azure portal, Azure CLI, Azure PowerShell, or REST APIs.

Using the Azure Portal

  1. Navigate to the virtual machine or disk you want to snapshot.
  2. Under the Disks section, select the disk.
  3. Click Create snapshot.
  4. Configure the snapshot settings (name, resource group, location).
  5. Click Create.

Using Azure CLI

To create a snapshot of an OS disk:


az snapshot create --resource-group MyResourceGroup --name MySnapshot --source <os-disk-name>
            

To create a snapshot of a data disk:


az snapshot create --resource-group MyResourceGroup --name MyDataDiskSnapshot --source <data-disk-name>
            

Using Azure PowerShell

To create a snapshot of an OS disk:


New-AzSnapshotConfig -SourceResourceId <os-disk-resource-id> -StorageSku Standard_LRS
New-AzSnapshot -Snapshot $snapshotConfig -ResourceGroupName MyResourceGroup -SnapshotName MySnapshot
            

Restoring from a Snapshot

Snapshots can be used to create new managed disks, which can then be attached to new or existing virtual machines.

Creating a Disk from a Snapshot

Azure CLI:


az disk create --resource-group MyResourceGroup --name MyRestoredDisk --source MySnapshot
            

Azure PowerShell:


New-AzDiskConfig -SourceResourceId <snapshot-resource-id> -CreateOption FromImage
New-AzDisk -DiskName MyRestoredDisk -DiskConfig $diskConfig -ResourceGroupName MyResourceGroup
            

Managing Snapshots

You can manage your snapshots through the Azure portal or command-line tools. This includes deleting old snapshots to save costs.

Best Practices

Tip

Azure Backup provides a more robust and automated solution for VM backup and disaster recovery, leveraging snapshots behind the scenes.

Important

The cost of snapshots depends on the size of the disk and the storage tier (Standard or Premium) of the snapshot. Managed snapshots are generally more cost-effective and easier to manage than unmanaged snapshots.

Back to Top