DEV Community

Cover image for How to Create a VM Image, Store it in Azure Compute Gallery, and Deploy a Virtual Machine Scale Set (VMSS).
SUBAIR NURUDEEN ADEWALE
SUBAIR NURUDEEN ADEWALE

Posted on

How to Create a VM Image, Store it in Azure Compute Gallery, and Deploy a Virtual Machine Scale Set (VMSS).

Introduction
This guide will walk you through the process of creating a generalized image of an Azure VM and storing it in an Azure Compute Gallery (formerly known as Shared Image Gallery). This allows you to reuse VM configurations and deploy multiple identical VMs efficiently.

This guide covers:

  • Creating an Azure Compute Gallery.
  • creating VM image from the existing VM
  • Storing the VM image in the gallery
  • Deploying a Virtual Machine Scale Set (VMSS) from the custom image.

Step 1 Create Azure Compute Gallery

An Azure Compute Gallery (formerly Shared Image Gallery) image is a managed resource that stores and organizes custom VM images in Azure

  • In the search bar, type "Compute Galleries" and select it

  • Click + Create

  • Fill in the details:
  • Subscription: Select your subscription
  • Resource group: Select existing or create new
  • Name: Enter a name (e.g., "SankidsGallery")
  • Region: Select a region (e.g., Central US)
  • Click Review + create,

  • Then Create

-Click on go to resources to see the created gallery.

-Compute Gallery is created successfully (sankidsGallery)

Step 2 Create a VM Image from an Existing VM

Creating a vm image means you want to create a replica of the original image with the same configuration and settings.

  • In the search bar, type "Virtual Machine" and select it

  • Select the existing Virtual Machine

  • click Capture drop down and select image.

  • In the "Create image" blade:
  • Select resource group (sankidsRG)
  • Choose Operating system state (I picked specialised because i dont want the users of the image to login into the vm with any credentials.
  • Create new Target Vm image definition

  • Give the target vm image definition a name (sankidsImageDefinition)
  • Click OK

  • set version number to 0.0.1
  • Click Create + review

  • Click create

  • Click go to resources to see your image

Step 3 Deploy a VM Scale Set from the Custom Image

A Virtual Machine Scale Set (VMSS) is an Azure service that allows the automatic deployment and scaling of identical VMs based on demand.

  • In the search bar, type "Compute Galleries" and select it

  • Select your gallery (sankidsGallery)

-Select your image (sankidsimageDefinition)

  • Click on + Create VMSS to create a virtual machine scale set.

  • Select resource group (sankidsRG)
  • Give your Virtual Machine scale set a name (sankidsscaleset)
  • Select availability zone (zone 1)
  • Ocherstration mode is set to uniform

  • Scaling mode is set to manual
  • Instant count is set to 4 (set based on your preference
  • Select sankidsImageDefinition for the image

  • The administration account is grade-out because we select specialised mode when creating the image.
  • Select licensing type (windows client)
  • Click review + create

  • Click Create

  • Click on go to resources to view your deployed virtual machine scale set

  • Four instance of Virtual machine scale set as been created succesfully.
  • Click on status to view the four vmss

Conclusion
In this guide, we successfully walked through the process of creating a custom VM image, storing it in an Azure Compute Gallery, and deploying a Virtual Machine Scale Set (VMSS) for scalable and consistent VM deployments. By leveraging Azure Compute Gallery, organizations can efficiently manage and distribute standardized VM images across teams, ensuring consistency, reducing deployment time, and optimizing resource utilization.

Top comments (0)