How To Create An Azure Virtual Machine From A Snapshot

In this video Matt will show you how to use a Powershell script to create a new virtual machine in Microsoft Azure from an existing OS disk Snapshot.

An Azure managed disk snapshot is a point-in-time copy of a managed disk. By using the snapshot to create a new virtual machine we can effectively create a copy of an exisiting VM at an earlier point in time without affecting the original or we can programatically create one or many clones of an exisiting VM.

We use the command New-AzureRmDiskConfig to first define a new disk configuration based upon the snapshot and then New-AzureRmDisk to actually create the new managed OS disk.

We then start to build the virtual machine using New-AzureRmVMConfig to define a new VM configuration and Set-AzureRmVMOSDisk to then add the newly created managed OS disk to the VM configuration. Network settings are configured and a NIC added to the VM configuration and then finally we use the command New-AzureRmVM to create thew new virtual machine with an OS disk built from the snapshot.

Pre-requisites An Azure subscription An OS disk snapshot An Azure resource group An Azure vNet Azure PowerShell module version 5.1.1

Prerequisites include: Azure subscription, resource group and vnet.