ADVERTISEMENT
TechEconomy
Friday, May 9, 2025
No Result
View All Result
Advertisement
  • News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
      • Accessories
      • Phones
      • Laptop
      • Gadgets and Appliances
      • Apps
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
      • Broadband
    • Mobility
    • Environment
    • Travel
    • Commerce
    • StartUPs
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • Appointment
    • EventDIARY
    • Editorial
  • Apply
  • TecheconomyTV
  • Techeconomy Events
  • BusinesSENSE For SMEs
  • TBS
  • News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
      • Accessories
      • Phones
      • Laptop
      • Gadgets and Appliances
      • Apps
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
      • Broadband
    • Mobility
    • Environment
    • Travel
    • Commerce
    • StartUPs
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • Appointment
    • EventDIARY
    • Editorial
  • Apply
  • TecheconomyTV
  • Techeconomy Events
  • BusinesSENSE For SMEs
  • TBS
No Result
View All Result
Tech | Business | Economy
No Result
View All Result
Podcast

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
0
Azure Image Builder by Paul Udomi
Paul Udomi

Paul Udomi

RelatedPosts

Blog Rank | SEO and Keywords by Chidinma

Quick Guide for Media Professionals If you Want Your Blog Post to Rank High

May 9, 2025

Localizing Content SEO: Winning Organic Traffic in Multilingual Markets

April 25, 2025

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:

United BANK
  • 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:

United BANK

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

Loading

0Shares

Tags: Azure Image BuilderCustom Image BuildIT Cloud EngineerPaul Udomi
Previous Post

Rack Centre: 12MW LGS2 Data Centre Offers Lowest Power Usage Efficiency in Nigeria

Next Post

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

Techeconomy

Techeconomy

Related Posts

Blog Rank | SEO and Keywords by Chidinma
How To

Quick Guide for Media Professionals If you Want Your Blog Post to Rank High

by Techeconomy
May 9, 2025
0

You’ve spent hours researching, writing, and editing your blog post. You’ve even sprinkled in a few catchy headlines and optimised...

Read more
Localizing Content SEO: Winning Organic Traffic in Multilingual Markets

Localizing Content SEO: Winning Organic Traffic in Multilingual Markets

April 25, 2025
Innovorg HiPO & career Pathing Module

Workforce Development: Innovorg Unveils HiPo, Career Pathing Module

April 1, 2025
WhatsApp Business App

Five WhatsApp Business Features Every Small Business Should Be Using

March 26, 2025
A Gen Z staying ahead with AI hacks

6 AI Hacks Helping Nigerian Gen Zs Hustle Smarter, Live Better, and Stay Ahead

March 14, 2025
SaaS Products in Nigeria | Adeoluwa Oni

Go-to-Market Strategies for Launching SaaS Products in Nigeria

February 13, 2025
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.

Techeconomy Podcast

Techeconomy Podcast
Techeconomy Podcast

Infowave is brought to you by TechEconomy. Every week we will bring new stories from startups and influencers who are shaping and changing the world we live in. We’ll also bring you reports on topics you should know.

Follow us @techeconomyng for more.

CYBERSECURITY ESSENTIALS
byTecheconomy

BUILDING STRONGER NETWORKS AND COMMUNITIES

CYBERSECURITY ESSENTIALS
CYBERSECURITY ESSENTIALS
April 24, 2025
Techeconomy
Digital Marketing Trends and strategies for 2025 and beyond
February 27, 2025
Techeconomy
Major Lesson for Techies in 2024 and Projections for 2025
December 6, 2024
Techeconomy
Major Lessons for Techies in an AI-Driven World | Techeconomy Business Series Highlights
November 26, 2024
Techeconomy
Maximizing Profitability Through Seasonal Sales: Strategies For Success
November 8, 2024
Techeconomy
Techeconomy Business Series
October 15, 2024
Techeconomy
PRIVACY IN THE ERA OF AI: GETTING YOUR BUSINESS READY
May 30, 2024
Techeconomy
Unravel the Secrets of Marketing Everywhere All At Once with Isaac Akanni from Infobip | Infowave Podcast Episode 1
February 9, 2024
Techeconomy
The Role of Ed-tech in Life Long Learning and Continuous Education
October 19, 2023
Techeconomy
Filmmaking and Technology: A chat with Micheal Chineme Ike
June 7, 2023
Techeconomy
Search Results placeholder

WHAT IS TRENDING

https://www.youtube.com/watch?v=g_MCUwS2woc&list=PL6bbK-xx1KbIgX-IzYdqISXq1pUsuA4dz
uba

Follow Us

  • About Us
  • Contact Us
  • Careers
  • Privacy Policy

© 2025 Techeconomy - Designed by Opimedia.

No Result
View All Result
  • News
  • Tech
    • DisruptiveTECH
    • ConsumerTech
      • Accessories
      • Phones
      • Laptop
      • Gadgets and Appliances
      • Apps
    • How To
    • TechTAINMENT
  • Business
    • Telecoms
      • Broadband
    • Mobility
    • Environment
    • Travel
    • Commerce
    • StartUPs
    • TE Insights
    • Security
  • Partners
  • Economy
    • Finance
    • Fintech
    • Digital Assets
    • Personal Finance
    • Insurance
  • Features
    • IndustryINFLUENCERS
    • Guest Writer
    • Appointment
    • EventDIARY
    • Editorial
  • Apply
  • TecheconomyTV
  • Techeconomy Events
  • BusinesSENSE For SMEs
  • TBS

© 2025 Techeconomy - Designed by Opimedia.

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