Introduction
This will guide you through the steps to build a reusable image from an Azure Virtual Machine (VM) and save it in an Azure Compute Gallery (previously called Shared Image Gallery). By doing this, you can replicate VM setups and launch multiple identical VMs quickly and consistently.
Here's what we'll cover:
- Setting up an Azure Compute Gallery
- Capturing a VM image from an existing virtual machine
- Uploading and storing the image in the gallery
- Using the custom image to deploy a Virtual Machine Scale Set (VMSS)
Step 1:Setting up an 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 "Azure Compute Galleries" and select it
Fill in the details:
Subscription: Select your subscription
Resource group: Select existing or create new
Name: Enter a name (e.g., "AlphaGallery")
Region: Select a region (e.g., West US)
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 "Create image" blade:
Select resource group (AlphaRG)
Choose Operating system state (I picked specialised because i dont want the users of the image to login into the vm with any credentials) Generalised requires Login Access.
Give the target vm image definition a name (AlphaImageDefinition)
set version number to 0.0.1
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 "Azure Compute Galleries" and select it
Click on + Create VMSS to create a virtual machine scale set.
Select resource group (NK_RG)
Give your Virtual Machine scale set a name (Alphascaleset)
Select availability zone (zone 1)
Scaling mode is set to manual
Instant count is set to 3 (set based on your preference
The administration account is grade-out because we select specialised mode when creating the image.
Click on go to resources to view your deployed virtual machine scale set
Three instance of Virtual machine scale set as been created succesfully
Conclusion
This project successfully demonstrated the creation of a reusable image from an Azure Virtual Machine and its integration into an Azure Compute Gallery. The image was then deployed through a Virtual Machine Scale Set, enabling consistent replication of VM configurations across multiple instances. This approach enhances scalability, simplifies infrastructure management, and ensures uniformity in deployment environments. The outcome validates the effectiveness of Azure Compute Gallery in streamlining VM provisioning for enterprise-grade solutions.
Top comments (0)