Step-By-Step: Creating a VM Snapshot in Azure

Hello folks,

As you may know, I’ve been travelling around the country for the Cloud and Mobility Summit.  During these events we’ve been running day long “camps” or hands-on training for both “Getting Started with Microsoft Azure for IT Professionals” and “Getting Started with Identity Management & Business Mobility Enablement for IT Professionals”

During these camps a lot of questions/scenarios are discussed.  Today I wanted to cover snapshots in Azure since its a topic that keeps coming back.

Before you get going, I recommend this Microsoft Virtual Academy free online training to get up to speed – Microsoft Azure IaaS Deep Dive Jump Start and if you are interested in Enterprise Mobility you HAVE to check out this webcast series.

VM Snapshots

First, let me go on record to say that I'm not a huge fan of Snapshots.  Not because they don't serve a propose, but because they are regularly used as a proper backup replacement.  We’ll discuss VM backups in a upcoming post.  but for now let’s just keep it to VM snapshots.

In Azure we’re not taking a snapshot the same way we take snapshots/checkpoints in Hyper-v.  In Azure, a blob snapshot is a read-only version of a blob that's taken at a point in time. Once a snapshot has been created, it can be read, copied, or deleted, but not modified. Snapshots provide a way to back up a blob as it appears at that moment in time.

A snapshot of a blob has the same name as the base blob from which the snapshot is taken, with a DateTime value appended to indicate the time at which the snapshot was taken. For example, if the page blob URI is, the snapshot URI will be similar to This value may be used to reference the snapshot for further operations. A blob's snapshots share its URI and are distinguished only by this DateTime value

Creating a VM Snapshot

For the creation of a VM blob snapshot we’ll use a PowerShell script created by a friend of mine, Chris Clayton.  You can download it here.  Once downloaded you need to expand it to a local directory and you will have the following structure and files.


Before you go and run any scripts there are a few things to take care off.

1- Ensure you have the latest Windows Azure PowerShell Module.  You can follow the step outlined here.

2- You need to download and import the certificate using the  following PowerShell command. Get-AzurePublishSettingsFile and Import-AzurePublishSettingsFile

3-You need to edit the Subscription.CSV file to include the following:

  • SubscriptionName
  • SubscriptionId
  • CertificateThumbprint

the SubscriptionName (1)  and the SubscriptionId (2) can be found in the Settings tab of the Azure portal


And the CertificateThumbprint (3) can be found under Settings>Management certificates.


3- Now that the info is in a place where the script can get to it, we will run the SnapshotVirtualMachine.ps1 script to capture the Blob snapshot.  (the command should be on one line. It’s has been formatted to fit this page.)

-subscriptionName "Microsoft Azure Internal Consumption"
-cloudServiceName "azrsnapshot"
-virtualMachineName "snapshot"
-shutdownMachine –snapshotOsDisk

You’ll notice that the command includes –shutdownMachine .  It is recommended that you shutdown the VM to perform the snapshot.  Mostly because this is a storage function of Azure not a hypervisor function.

if everything goes well, you’ll get the following display.


Managing Snapshots

The script ZIP file you downloaded contained several other scripts to allow you to manage your snapshots:


./GetSnapshotList.ps1 -subscriptionName "SubscriptionName" -cloudServiceName "CloudServiceName" -virtualMachineName "VMName" -maximumDays 15

The default “-maximumDays” parameter is 30 if you don't specify one.  in our case we use 15 to show the command possibilities.


./DeleteOldSnapshots.ps1 -subscriptionName "SubscriptionName" -cloudServiceName "CloudServiceName" -virtualMachineName "VMName" -maximumDays 15


The date format is taken from the result of the DeleteOldSnapshots.ps1 command.

./RestoreVirtualMachine.ps1 -subscriptionName "SubscriptionName" -cloudServiceName "CloudServiceName" -virtualMachineName "VMName" -utcRestoreDate "2013-JUL-18 15:00:00" -restoreDataDisks

I hope this helps,

you can use some of this code to automate the snapshot process….  remember that a snapshot is NOT a proper replacement for a real backup strategy.



Pierre Roman | Technology Evangelist
Twitter | Facebook | LinkedIn


Comments (2)

  1. Joe Teed says:

    The settings tab is gone now. Finding those items is much harder without it.

  2. Joe Teed says:

    Nevermind. There’s a separate portal for that.

Skip to main content