How to create a managed image of a generalized VM in Azure

Traditionally IT Admins have been using a concept of a Gold Image to deploy a consistent server environment within their organization. In Oder to create a gold image template, they first install an operating system in a VM and then install all the organizational prerequisites on this VM and finally Sysprep the VM to create it as an image.

once a gold image template is created, this image can be reused for deploying multiple VMs with the same configuration and consistency. Azure also supports the concept of gold image to deploy a desired and consistent environment.

capture

 

Important Considerations
  • VM Image will be created at the same Azure Datacenter where the captured VM was running
  • if you deploy workloads to multiple Azure regions, create multiple VM images for multiple Azure Regions
  • Newly created VMs from VM Image will only use Azure managed disk
  • Windows update for VM image isn’t possible. you will need to update the newly created VM immediately after its creation

Let’s create a gold image step by step –

Step1

Create a new Azure VM. I installed a new VM with Windows 2012 R2 operating system

Step2

Once VM is installed, Install all the prerequisites required for your organization, I installed .Net framework 3.5 from add/remove features

Step3

Login to newly created VM and open a command prompt and Sysprep the VM by running:

%windir%\system32\sysprep\Sysprep.exe

Select the options as shown in print screen. this will shutdown the VM once syspreped is completed

1

Step4

Login to Azure portal. select the VM which was recently syspreped and select Capture from the options

2

Step5

Use following option:

  • Provide a name for the Image – Use a meaningful name
  • Select the resource Group
  • Select Automatically delete this virtual machine after creating the image
3
Step6

Once completed, Syspreped VM will be deleted. open the Azure portal and navigate to Image.

4

 

 

 

Since my VM was running in southeast Asia. a new VM Image is also created at Southeast Asia

5

Step7

Select the Image and it will allow to create a new VM from this image

6

 

Step8

New VM can only be created at the same location where the Image is. this cant be changed

7

 

 

 

 

 

 

 

 

 

 

 

 

New VM can only use Azure managed disk

8

Once completed a new VM will be created from the VM Image. You can repeat these steps to create multiple VMs from this gold image.

 
Cheers!!
  • Harinder Kohli

    Does the time to create a new VM from a image or creating a new VM through normal process is same.

    • Deepak Maheshwari

      It took almost 5 minutes to create a VM from the gold image. I guess its almost the same time as a normal VM creation