DEV Community

Cover image for Azure Applied Skills: Creating a VM Image and Azure Compute Gallery
John Ogbonna
John Ogbonna

Posted on

Azure Applied Skills: Creating a VM Image and Azure Compute Gallery

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
Enter fullscreen mode Exit fullscreen mode
  • Linux: Open a terminal and run:
sudo waagent -deprovision+user
sudo shutdown -h now
Enter fullscreen mode Exit fullscreen mode
  • Ensure the VM status is stopped (deallocated) in the Azure Portal. deallocated

Step 2: Create the new image

  • Select Capture. Select image
    Select 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
    name and click OK

  • For Operating system state, we will select Specialized

  • Click create new under Target VM image definition

  • Name the Image definition

  • Click ok in the side pannel
    Image Settings

  • Click Review + create
    Click Review + create

  • Click create
    Click create

  • Wait for the deployment
    Wait for the deployment

  • Click go to resource
    Click go to resource

Step 3: Confirm Image

  • Notice that you can create both a new VM and VMSS based on this image VM and VMSS based on this

Following these steps, you have now created and stored a VM Image that you can now use to create more VMs or a VMSS!

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

👋 Kindness is contagious

If you found this post useful, please drop a ❤️ or leave a kind comment!

Okay