Introduction
In this guide, we will walk through the process of creating a VM image and publishing it to the Azure Compute Gallery. This allows for efficient management and deployment of standardized VM images across multiple Azure regions.
Prerequisites
Before starting, ensure you have:
An active Azure subscription
Access to the Azure Portal
A Virtual Machine (VM) to capture an image from
What is Azure compute gallery
Azure Compute Gallery is a centralized service for managing and sharing VM images across multiple regions. It enables versioning, replication, and controlled access to ensure fast, consistent, and scalable VM deployments.
Key Benefits:
Versioning & Replication – Maintain multiple image versions and distribute them globally.
Faster Deployments – Pre-configured images speed up provisioning.
Consistency & Scalability – Ensure uniform VM configurations across deployments.
Cost Efficiency – Reduce storage costs with shared image replicas.
Step 1: Prepare the VM for Image Capture
Before capturing a VM image, ensure the VM is in a generalized state
Deprovision the VM (Windows/Linux):
- Windows: Open PowerShell and run:
sysprep.exe /generalize /shutdown
- Linux: Open a terminal and run:
sudo waagent -deprovision+user
sudo shutdown -h now
- Ensure the VM status is stopped (deallocated) in the Azure Portal.
Step 2: Create the new image
Select Resource group
Select
Yes, share it to a gallery as a VM image version
Select Create New under Target Azure compute gallery, enter a name and click OK
For Operating system state, we will select Specialized
Click create new under Target VM image definition
Name the Image definition
Step 3: Confirm Image
- Notice that you can create both a new VM and VMSS based on this image
Following these steps, you have now created and stored a VM Image that you can now use to create more VMs or a VMSS!
Top comments (0)