There are some scenarios where the managed Azure Backup Services may not be a suitable fit. So let’s discuss more on the custom backup strategy which uses snapshots behind the scenes.

Azure Storage provides the capability to take snapshots of blobs.

Before we dig into Snapshot strategy, lets understand, “What’s a Snapshot ?”
In Hyper-V Environment, the configuration, memory and supporting process information is saved and a differential 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 differential disks associated with the snapshots must be merged with the original VHD, as the following diagram shows:


In Azure it’s almost similar where Azure captures the blob state at the given 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 creates 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:https://docs.microsoft.com/en-us/azure/storage/storage-blob-snapshots

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.

In the next part we will understand how to restore an unmanaged disk VM in Azure using Powershell Scripts. Keep following us to know more features and implementations on Azure.