Create a Gold Image from Azure VM

A gold image provides consistency in what is installed, configured, and used for all running instances of Azure VMs. The use of the gold template streamlines the deployment process. It also reduces the time to provision large numbers of virtual machines.

In this blog post, we will show you how to prepare a Microsoft Azure Virtual machine and create a gold image that can be used over and over and reduce the time it takes to install and configure VM after providing them.

With Microsft Azure Compute Image Gallary, we can save the image into a private image gallery and allow other users in the tenant to access the image and deploy VMs.

The process to create a gold image is split into two:

  1. Create a VM, install and configure the VM with all apps and configuration and run sysprep.
  2. Capture the image from the VM and save it into an Azure Compute Gallary.

Once the two steps are completed, we can create VMs from the image.

SysPrp

Microsoft Sysprep utility helps us generalize a Windows machine and remove profiles, security IDs, and other information from the VM. By running Sysprep, we are cleaning the VM and making it ready to be imaged.

After installing all apps and configuring a new VM, we can run Sysprep. To run Sysprep, open the following path c:\windows\system32\sysprep

Double click on Sysprep

From the tool menu, tick the Generalize check-box and select Shutdown.

The VM will shut down. From you will need to stop the VM as well.

Capture and Save Image

After the VM is shut down, we can create a gold image and save it to the gallery. From the Azure portal, open the VM and click on Capture.

From the Capture page, set all the settings as shown below. You will need to click on Create now Azure compute gallery and select Generalized the VM.

Note: If you prefer not to create an image gallery, select the second option (No, capture only a managed image). The big difference when not using a gallery is that the image will be available only in the region it was created and for the user that created it. an image saved in a gallery will be available across all regions and subscriptions.

Fill in all the details and wait for the Capture to complete.

Use the Gold Image

To use the image, I will create a new Azure VM from the portal (this can also be done from PowerShell or ARM) and from the image selection section, I will click on See all images.

From the My items page, I will select Shared Images and click on my gold image.

After selecting the image, continue with the process and create the VM.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.