Menu

Azure – Create a windows VM from a generalized image

This blog shows you how to create a windows VM from a generalized image. This uses un-managed Azure disks.

For this example, I will be using resources deployed on Azure. i.e., generalize an Azure VM, create a image out of it and then create a new Azure VM using the image.

Below are the steps:

Generalize the VM

Capture a VM image from a generalized Azure VM, that we obtain from Step 1

Create a VM from a generalized VHD image in a storage account, that we obtained from step 2

Part 1: Generalize the VM

Remote Desktop to the Azure virtual machine

**Important** Before running the “Sysprep.exe”. Delete the “unattend.xml” file from the “C:\Windows\Panther” folder. If you do not do this, you will encounter “OS Provision time out” exception while creating the VM from this image.

This is due to the fact that when an image is deployed the unattend.xml file must come from the ISO image that is attached to the Virtual Machine by Windows Azure as part of VM provisioning from an image.

-DestinationContainerName, is the container name where the image will be stored.-VHDNamePrefix, is the prefix given to the image.-Path, is the path of json file that contains the details of the image that gets created.

You can get the URL of your image from the JSON file template. Go to the resources > storageProfile > osDisk > image > uri section for the complete path of your image. The URL of the image looks like: