DEMO: Restoring a VM from a Snapshot


Course Introduction
Start course

This course covers disks, snapshots, and images in Azure. We'll explore the benefits of managed disks and the types of encryption you can use with them, before moving on to look at the different disk types that are available in Microsoft Azure. A guided demo from the Azure portal will show you how to add a data disk to an Azure VM.

We'll then dive into snapshots and images, where you'll learn about disk snapshots, custom images, and the differences between them. We’ll wrap things up with a few demos, where you'll get to see how to restore a VM from a snapshot and how to create a VM from a generalized image.

Learning Objectives

  • Learn about the benefits of managed disks, the different disks available in Azure, and how to add a disk to an Azure VM
  • Learn about snapshots and images and their characteristics
  • Restore a VM from a Snapshot
  • Create a VM from a Generalized Image

Intended Audience

This course is intended for those who wish to learn about disks, snapshots, and images in Microsoft Azure.


To get the most out of this course, you should have some basic knowledge of working with Azure.


Hello and welcome back. In this demonstration, we are going to walk through the process of creating a snapshot of an existing OS disk for a virtual machine. What we'll then do is create a disk from that snapshot and then what we'll do is we'll deploy a new VM from the disk that's created from the snapshot.

So on the screen here, I'm logged into my Azure portal and I'm in my VMStuff resource group. In my VMStuff resource group is a virtual machine that I created for this demonstration and I called it MyVM. This virtual machine has one disk and it's the OS disk and we're going to take a snapshot of this disk.

So to get started, we'll select our VM here and then what we'll do, we'll go into disks and we can see the disk here. To take a snapshot of it, we simply select the disk and then create snapshot.

Now, before we do that, let's bounce back out to the VMStuff resource group. What I could do is just select the disk right from within the resource group as well. Now the best way to take a snapshot of a disk is to shut down the VM that's actually using the disk because you don't want to capture a snapshot that may or may not capture any running processes.

So what I'm going to do is go out to MyVM and we'll stop the VM here. Now it's going to ask me if I want to reserve my public IP. And this is because my public IP for this VM is dynamically assigned and that's, I don't really care about the public IP for this exercise.

Now, what this will do is stop MyVM and once MyVM is stopped, I'll go out, create the snapshot and then I'll spin up a disk from that snapshot and then we'll spin up a VM from that disk. And we're now stopped and deallocated. So let's go into my disks here and we'll select the OS disk. And then from here, it's a simple process. We simply click Create snapshot and then what we do, we tell Azure what resource group should host our snapshot and we'll put it in the same resource group, VMStuff. And we're going to call this snapshot simply MySnapshot. 

Now when we take a snapshot, we have two options, we can take a full snapshot or we can take an incremental snapshot. The incremental, as you can see here, allows us to save on storage by taking a partial copy of the disk based on the difference between now and the last snapshot. We're going to take a full snapshot here.

Now we can also tell Azure what storage type to use. We can either use a standard HDD premium SSD or zone-redundant storage. We'll just leave the default here for zone-redundant. And then if we select next for encryption, we can tell Azure what kind of encryption we wanna use. We can either use the default encryption at rest with the platform managed key, which is what we're going to do here or we could specify encryption at rest and supply a customer-managed key.

We're going to go with the default option here. We'll next it for tags, we're not going to do any tagging here. And at this point, we look at our validation, everything looks good so we'll go ahead and create our snapshot. We can see here that our snapshot is already completed so we'll go ahead and go to our resource here.

We can see MySnapshot has been created and that it's unattached. If we go back out to the resource group, we can see MySnapshot sitting here. So now that we have our snapshot created, let's go ahead and create a disk from that snapshot.

Now, to do that, we'll go up into our search box here and we'll search for disks. So we'll select disks here. Now we can already see our OS disk, but what we wanna do is create a new disk from our snapshot. So let's go ahead and click Add and then again, we need to tell Azure where we're going to deploy this resource, so we'll go into VMStuff, we'll select our East US region and we'll call this MyDisk.

Now we could select an availability zone here, but I don't really need any availability for this demonstration, but in the source type, I do need to select where I'm going to source this disk from. Do I want to create a new empty disk? Do I want to create the disk from a storage blob or as I want to do in this case, do I want to create from a snapshot?

So we'll go ahead and click snapshot here and then we'll select MySnapshot. As you can see here in the size section, the size of a new disk doesn't have to match the actual snapshot itself. The original snapshot at disk was 127 gig. This process here wants to create a one terabyte disk by default.

I'm going to change this and scale it down to a hundred and twenty eight gig and then if we select encryption here, again, we can specify the encryption type. We have the same options that we had earlier so I'll leave it at its default encryption option, go through tags and then we'll create the disk. And we can see our resource has been provisioned and we now have a disk. And you can see from the overview page, we can create a snapshot of the disk or we can create a VM.

If we go back out to our resource group. And I like to come out here just so you can see it from a context perspective. We can now see the snapshot, we can see our VM, we don't see any disk here yet, but if we refresh, we can now see MyDisk as well. So this MyDisk has been created based on the snapshot which was taken of the OS disk for MyVM.

So let's assume we took this snapshot and created this disk because we were going to maybe do some patching for MyVM. Let's also assume that the patching went south, let's assume the patching caused all kinds of blue screens on our virtual machine. What we could do to recover that virtual machine since we have a snapshot of it that we took right before we began the patching and we've created a disk from that snapshot, let's just kill this virtual machine off completely. I'll leave the virtual network here.

So, what I'm doing here is simulating just a dead server. You know, we patched the server, it came up and it blue screened and we couldn't get back into it. So what I wanna do is recover that server. Well, since we have a snapshot of the only disk on that initial server, which is the OS disk, we can use our snapshot and the associated disk to recover it. And I'll just let this refresh here and what we're going to do is go into MyDisk, which is independent by the way of this VM, I've deleted this VM or I am deleting it, I should say.

Just because I delete the VM doesn't mean anything happens to the new disk nor to the snapshot. These two resources are independent of the VM that they were created from. So once this VM is removed, what we'll do is we'll create a new MyVM from MyDisk and that VM will be identical to the original because it's based on the snapshot of that VM.

So our VM is gone and now what we'll do is we'll simulate the recovery. Boss came to you and said, "Hey, what happened?" And your response is the patch has blue screened it. So let's go ahead and recover that virtual machine.

We'll do that by selecting MyDisk and then we'll create a VM from it. In a production environment, you'd typically call the new machine the same machine name as the original. And we can see here that the image is now MyDisk and we can select the size for our VM and we'll just select a DS1 v2. We'll allow the 3389 and don't do that in production, please. Allowing 3389 over the internet is a huge no, no. This is just a lab environment.

We'll go ahead and click through Next for disks. We'll accept the defaults here. In networking, we're going to deploy to our original virtual network, but it's going to create a new public IP and we'll just click through here, accept the defaults, that's all we're concerned about for this demonstration. We aren't going to do any tagging and then we'll create. And what this is doing is creating a new virtual machine using the disk that we created from the snapshot.

What this leaves us with is a new virtual machine that has an identical configuration to that of the VM that we created the snapshot from. I'm not going to make you sit through this deployment so we'll call it a wrap here and I'll see you over in the next lesson where we will work with images.

About the Author
Learning Paths

Tom is a 25+ year veteran of the IT industry, having worked in environments as large as 40k seats and as small as 50 seats. Throughout the course of a long an interesting career, he has built an in-depth skillset that spans numerous IT disciplines. Tom has designed and architected small, large, and global IT solutions.

In addition to the Cloud Platform and Infrastructure MCSE certification, Tom also carries several other Microsoft certifications. His ability to see things from a strategic perspective allows Tom to architect solutions that closely align with business needs.

In his spare time, Tom enjoys camping, fishing, and playing poker.