Azure ARM VM Snapshot

As Azure provides a perfect Azure Backup Solution for Virtual Machines. There is another alternate way where you can create your own customized Backup Solution for Virtual machines using Blob Snapshots.

Azure Storage provides the capability to take snapshots of blobs.

You might me wondering what is a Snapshots ?

Traditional Snapshot In Hyper-V Environment the configuration, memory, and supporting process information is saved and a differencing disk is created to store future disk changes. When you delete a VM, all the snapshots are deleted. However, the virtual hard disk (VHD) is not deleted, which means all content stored in the differencing disks associated with the snapshots must be merged with the original VHD, as the following diagram shows.

In Azure its similar where Azure capture the blob state at that point in time. Lets dig down the scenario of how we can maintain backups of virtual machine disks using snapshots.

What is a Blob Snapshot?
A blob snapshot is a read-only version of a blob that is captured at a point in time. Once a snapshot has been created, it can be read, copied, or deleted, but not modified.

Note: Snapshots can be copied to another storage account as a blob to keep backups of the base blob. You can also copy a snapshot over its base blob, which is like restoring the blob to an earlier version. When a snapshot is copied from one storage account to another, it will occupy the same space as the base page blob. Therefore, copying whole snapshots from one storage account to another will be slow and will also consume lot of space in the target storage account

Steps for Implementing a full snapshot copy:

  1. First, take a snapshot of the base blob using the Snapshot Blob operation.
  2. Then, copy the snapshot to a target storage account using Copy Blob.
  3. Repeat this process to maintain backup copies of your base blob.

For execution, please find the Automated Powershell Script which Create Snapshot for unmanaged Virtual Machines in a resource group: Link

The above script is for creating Blob Snapshots for all Azure IaaS VMs(includes root volume and Data volumes) for Azure Resource Manager VM(unmanaged disks). This is intended to run only for Virtual Machines with TagName as "Environment" and TagValue as "Production". You can also automate the process of Blob Snapshot by publishing the script in Azure Automation as well with few changes.

See the corresponding article for details and instructions:

NOTE: It is suggested that you download the script file from this page instead of copying and pasting the script code below, in order to avoid any formatting issues that may affect script execution.

Thanks for reading. Following to this blog we will have a detailed blog explaining how to restore an unmanaged VM in Azure using Powershell Scripts.

Happy Reading :)

Raghuram Korukonda

Most of my time I spent working on Azure and contributing to Microsoft Azure and other Open Source Communities. I am passionate about Technology and helping people in embracing it to the fullest.

Hyderabad, India

Subscribe to Cloud Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!