• News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
    • Commerce & Mobility
    • Environment
    • Travel
    • StartUPs
      • Chidiverse
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • EventDIARY
    • Editorial
    • Appointment
  • TECHECONOMY TV
  • Apply
  • TBS
  • BusinesSENSE For SMEs
Saturday, December 20, 2025
  • Login
No Result
View All Result
NEWSLETTER
Tech | Business | Economy
  • News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
    • Commerce & Mobility
    • Environment
    • Travel
    • StartUPs
      • Chidiverse
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • EventDIARY
    • Editorial
    • Appointment
  • TECHECONOMY TV
  • Apply
  • TBS
  • BusinesSENSE For SMEs
  • Chidiverse
  • News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
    • Commerce & Mobility
    • Environment
    • Travel
    • StartUPs
      • Chidiverse
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • EventDIARY
    • Editorial
    • Appointment
  • TECHECONOMY TV
  • Apply
  • TBS
  • BusinesSENSE For SMEs
  • Chidiverse
No Result
View All Result
Tech | Business | Economy
No Result
View All Result
  • News
  • Finance
  • StartUPs
  • TechTAINMENT
  • Guest Writer
  • Digital Assets
  • IndustryINFLUENCERS
  • Environment
  • Macro Monday
ADVERTISEMENT

Home » Automating the Creation of Custom Image Build Using Azure Image Builder

Automating the Creation of Custom Image Build Using Azure Image Builder

Traditional VM image creation requires manual setup, installation, and configuration, which is time-consuming and error-prone. Azure Image Builder automates this process, PAUL UDOMI writes:

Techeconomy by Techeconomy
March 21, 2025
in How To
Reading Time: 16 mins read
0
Azure Image Builder by Paul Udomi

Paul Udomi

RelatedPosts

CAC: Step-by-Step Guide to Register Business in Nigeria

5 Affordable Smartphones to Gift Your Parents

BVN vs. NIN vs. TIN: What Every Business Owner Must Know Now

UBA
Advertisements

Introduction to Azure Image Builder

Azure Image Builder (AIB) is a managed service that simplifies the process of creating, customizing, and distributing virtual machine (VM) images across Azure.

It leverages Azure Resource Manager (ARM) templates or Bicep to automate the image-building process, ensuring consistency and security across deployments.

Why Use Azure Image Builder?

Traditional VM image creation requires manual setup, installation, and configuration, which is time-consuming and error-prone. Azure Image Builder automates this process, offering:

  • Consistency — Ensures every image is built with the same configuration.
  • Security — Allows pre-installation of security patches, compliance tools, and monitoring agents.
  • Efficiency — Reduces manual effort and automates image lifecycle management.
  • Multi-cloud & Hybrid Support — Supports deployment across Azure, on-premises, and even other clouds.

Key Features of Azure Image Builder

  • Custom Image Definitions — Define VM images with required OS, software, and configurations.
  • Image Templates — Specify the source, distribution method, and customization steps.
  • Integration with DevOps Pipelines — Automate image building using CI/CD workflows.
  • Shared Image Gallery Support — Store and manage images centrally for reuse.
  • Support for Windows and Linux Images — Build images for different OS environments.

Prerequisites for Running This Project

  1. Configure a self-hosted agent.
  2. Create a new or use an existing virtual network (az-uks-np01-aib-lan-vnet)
  3. Create a new or use an existing Managed Identity and assign the required RBAC role.
  4. Ensure existing resource groups are available:
    az-uks-np01-gallery-rg
    az-uks-np01-network-rg
    az-uks-np01-win-2019-aib-rg

Repository Structure for Image Builder Automation

Here’s the directory structure of our Azure Image Builder automation project:

infrastructure.platform.AIB  
│── infra  
│   ├── images  
│   │   ├── placeholder.json  
│   │   ├── ubuntu-pro-2204.bicep  
│   │   ├── win-2019.bicep  
│   ├── modules  
│   │   ├── imageDefinition.bicep  
│   │   ├── imageTemplate.bicep  
│── pipeline  
│   ├── azure-pipeline-images.yml  
│── README.md

Breakdown of Repository Components

  • infra/images/ – Contains Bicep templates for defining images (Windows 2019, Ubuntu Pro 22.04).
  • infra/modules/ – Reusable Bicep modules for defining Image Definition and Image Template.
  • pipeline/azure-pipeline-images.yml – Azure DevOps pipeline script that automates image creation.
  • README.md – Documentation for setup and usage.

Understanding Image Definition & Image Template

Image Definition (imageDefinition.bicep)

Defines the image structure within an Azure Shared Image Gallery, including:

  • OS type (Windows/Linux).
  • Publisher and offer details.
  • Shared Image Gallery location.

Image Template (imageTemplate.bicep)

Specifies the actual image customization process, including:

MTN New
  • Base OS Image (e.g., Windows Server 2019).
  • Custom scripts (installing software, security updates).
  • Distribution method (Shared Image Gallery, Managed Image).

Automating Image Builds Using Azure DevOps Pipelines

Now, let’s dive into the CI/CD pipeline that automates the Azure Image Builder process.

Pipeline Configuration (azure-pipeline-images.yml)

Triggering & Scheduling

  • Runs manually or on a monthly schedule (8 AM UTC on the 14th of each month).
schedules:
  - cron: "0 8 14 * *"
    displayName: Monthly build
    branches:
     include:
     - main
    always: true

Pipeline Parameters

  • Supports Windows 2019 and Ubuntu Pro 22.04 as build options.
  • Allows selecting between beta and stable environments.
parameters:
- name: mode
  type: string
  default: stable
  values:
    - beta
    - stable
- name: image
  type: string
  default: win-2019
  values:
    - win-2019
    - ubuntu-pro-2204

Pipeline Variables

  • Sets environment-specific values for resource groups, subscriptions, and service connections.
variables:
  - name: imageTemplateName
    value: <image template name>
  - name: fileToRun
    value: infrastructure.platform.AIB/infra/images/${{ parameters.image }}.bicep
  - name: version
    value: '$(Build.BuildNumber)'

Pipeline Stages

1. Build Stage — Compile Bicep Files

  • Checks out the repository.
  • Lists files in the source directory.
  • Builds the Bicep templates before deployment.
stages:
  - stage: Build
    displayName: 'Build Bicep'
    pool: $(agentPool)
    jobs:
      - job: BuildBicep
        steps:
          - checkout: self 
          - script: |
              echo "Listing files in $(Build.SourcesDirectory):"
              dir $(Build.SourcesDirectory)
            displayName: 'List Files in Sources Directory'
          - task: AzureCLI@2
            inputs:
              azureSubscription: $(serviceConnection)
              scriptType: "ps"
              scriptLocation: "inlineScript"
              inlineScript: |
                az bicep build --file $(fileToRun)

2. Deploy Stage — Deploy Image Builder Components

  • Deploys Image Definition and Image Template to Azure.
- stage: Deploy
    displayName: 'Deploy Bicep'
    pool: $(agentPool)
    jobs:
      - job: DeployBicep
        steps:
          - task: AzureCLI@2
            inputs:
              azureSubscription: $(serviceConnection)
              scriptType: "ps"
              scriptLocation: "inlineScript"
              inlineScript: |
                az deployment group create --name Image_$(Build.BuildId) \
                  --resource-group 'az-uks-${{ variables.environment }}-gallery-rg' \
                  --template-file $(fileToRun) \
                  --parameters infrastructure.platform.AIB/infra/images/placeholder.json \
                  version=$(version) environment=$(environment) name=${{ parameters.image }}

3. Build Image Stage — Execute Image Builder Process

  • Triggers Azure Image Builder to create the VM image.
  • Waits for image build completion.
- stage: BuildImage
    displayName: 'Build Image'
    dependsOn: Deploy
    pool: $(agentPool)
    jobs:
      - job: BuildImage
        timeoutInMinutes: 120
        steps:
          - task: AzureCLI@2
            inputs:
              azureSubscription: $(serviceConnection)
              scriptType: "ps"
              scriptLocation: "inlineScript"
              inlineScript: |
                az image builder run --name ${{ variables.imageTemplateName }} \
                  --resource-group 'az-uks-${{ variables.environment }}-gallery-rg' --no-wait
                az image builder wait --name ${{ variables.imageTemplateName }} \
                  --resource-group 'az-uks-${{ variables.environment }}-gallery-rg' \
                  --custom "lastRunStatus.runState!='Running'"

Key Benefits of This Approach:

  • Eliminates manual VM configuration.
  • Ensures compliance with security policies.
  • Reduces operational overhead.
  • Enables version-controlled image updates.

Code to the project repository can be found in the link: https://dev.azure.com/pauludomi0161/MiniLab/_git/infrastructure.platform.AIB

OUTPUT OF PIPELINE RUN IN AZURE PORTAL

Azure Compute Gallery RG:

*Paul Udomi, an IT Cloud Engineer is on LinkedIn.

0Shares

stanbic
Techeconomy

Techeconomy

Related Posts

Business Name Registration

CAC: Step-by-Step Guide to Register Business in Nigeria

by Techeconomy
December 18, 2025
0
0

Registering a business (name) in Nigeria has become far simpler over the years, thanks to reforms aimed at improving the...

Parents smartphones

5 Affordable Smartphones to Gift Your Parents

by Techeconomy
December 17, 2025
0
0

You don't need to spend a fortune to get a good smartphone for your parents. As more older adults embrace...

BVN, NIN, and TIN

BVN vs. NIN vs. TIN: What Every Business Owner Must Know Now

by Techeconomy
December 12, 2025
0
0

BVN, NIN, and TIN are three important identification numbers every business owner in Nigeria must understand. Each one serves a...

Tips For Managing Your Mental Health As A Busy Professional

Tips for Managing Your Mental Health as a Busy Professional

by Joan Aimuengheuwa
December 6, 2025
0
0

Take the time to review these tips for managing your mental health as a busy professional.

best smartphones for the holiday

Holiday Gift Guide 2025: Best Smartphones for Every Budget

by Techeconomy
December 4, 2025
0
0

The smartphone market in 2025 has reached an interesting point. The gap between cheap and expensive phones has become so...

Black Friday Deals 2023

How to Spot Fake Deals this Black Friday

by Techeconomy
November 29, 2025
0
0

The​‍​‌‍​‍‌​‍​‌‍​‍‌ annual Black Friday rush has grown from a one-day shopping event to a long digital competition for attention and...

Load More
Next Post
AfDB and Smallholder Farmers

AfDB Mulls $500M Facility to Mobilize Financing for Smallholder Farmers

Leave a Reply Cancel reply

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

I agree to the Terms & Conditions and Privacy Policy.

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

MTN New
UBA
Advertisements
  • About Us
  • Advertise
  • Careers
  • Contact Us

© 2025 TECHECONOMY.

No Result
View All Result
  • Home
    • Home – Layout 1
    • Home – Layout 2
    • Home – Layout 3
    • Home – Layout 4
    • Home – Layout 5
  • World
  • Politics
  • Business
  • Science
  • Tech
  • Entertainment
  • Lifestyle

© 2025 TECHECONOMY.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
This website uses cookies. By continuing to use this website you are giving consent to cookies being used. Visit our Privacy and Cookie Policy.