

During the process of manually* creating an image, it’s common to take snapshots. This cmdlet takes a snapshot of the OS disk.I’ve been working with numerous customers on Windows Virtual Desktop (WVD) deployments since I started my position at Microsoft. In the background, Azure is stopping the VM and creating a snapshot. Once executed, this may take a couple of minutes. You can see an example below of creating a snapshot for a VM called VM1 in the Demo resource group. The New-AzVmSnapshot only requires two parameters – the name of the VM and the resource group its located in. Once you’ve got a PowerShell console opened and authenticated to the Azure subscription where your VM lives, create a new snapshot with New-AzVmSnapshot. Run Install-Module AzureVMSnapshots to get the module downloaded and installed. Installing the AzureVMSnapshots module is easy since it’s available via the PowerShell Gallery.

In this article, you’re going to learn how to both back up and restore Azure virtual machines using a community PowerShell module called AzureVMSnapshots. You can rarely go wrong picking PowerShell as the scripting language of choice to make it happen. When a process isn’t as easy as you think it should be is a great time to build and use your own custom tool.

In the Azure cloud, it’s not quite as easy as clicking a few times though. There are always times when you need to back up a VM at a point in time and restore it at some later date. Taking a snapshot or a backup of a VM is commonplace. But, don’t fret, with the know-how you’ll learn in this tutorial, you can build your own tooling to create easy Azure VM snapshots! If you’re used to right-clicking on a VM in your favorite hypervisor and creating a snapshot, you’ll be in for a rude awakening when running VMs in the Microsoft Azure cloud.
