Using Azure Image Builder to build your custom VM Images – Part 3
Azure AI

Using Azure Image Builder to build your custom VM Images – Part 3

Content type Blog Post
Author T-Bone Granheden
Publication Date 15 Sep, 2026
Reading Time 4 minutes

Introduction

In the last two parts we covered how we can use Azure VM Image Builder to create our Images, and how we could troubleshoot if things went wrong. In Part 3 I will cover how we can automate the creation of the Image Template.

One of the biggest limitations of the Azure VM Image Builder in my opinion is, that you cannot change anything to the template or even to the scripts used within, once the Image Template is deployed to your Subscription.

Azure Resource Manager in PowerShell

To deploy our Image Template via Azure RM through PowerShell, we can use the exported Template from Part 1

We just need to extract the template files and can start:

If you do not yet have the Azure Az Module installed, we can do that now:

Once installed, we can connect to our subscription:

And we can deploy the Template (obviously you need to adjust the file paths to match your environment):

New-AzResourceGroupDeployment -TemplateFile "C:\01_DATA\PowerShell\template\template.json" -TemplateParameterFile "C:\01_DATA\PowerShell\template\parameters.json" -ResourceGroupName "AzureImageBuilder"

As mentioned above, we cannot modify an existing template, we need to remove it before, or the deployment will fail with an error like this:

Deploy via Azure DevOps

While the native PowerShell approach is already way more convenient than deploying it via the Azure Portal each and every time we want to change something, since we already have everything that we need, why not directly deploy it from an Azure DevOps Pipeline?

Project

For simplicity, I will assume you already have a DevOps Organization and we just need to create a new project. You can refer to the official docs, if you need to create a new org: https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops

Repository

Let’s first Initialize our first repository that will contain our templates and also stores our pipeline:

Now we just need to upload our template and parameters file:

And we are basically ready to go:

Service Connection

To deploy our template, we will need to setup a service connection to grant the pipeline access to our Resource Group:

Select Azure Resource Manager:

Select the Subscription and Resource Group to which it should be connected:

And save it:

Pipeline

Now that we have all prerequisites ready, we can finally create our build pipeline:

We will save our pipeline in our Azure Repos Git:

Select your repo:

And create a starter pipeline:

I will go with a windows based Image pool and add our ARM deployment step:

Select our subscription, connection and resource group details:

And define our template and parameter file locations:

So, we can finally save and run our pipeline

For the first execution, we will need to grant the pipeline the permission to use our service connection:

And it will start executing:

We now can easily deploy our Image Template after a modification in our definition. There are a lot more possibilities in the pipeline, like a parameter preselection when running, but this would exceed the target of this blog post:

Template parameters

Finally, I want to mention a few settings in the template files, that are may worth knowing to achieve your goal, check out the reference to learn more:

https://learn.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json?tabs=json%2Cazure-powershell

Timeout

One really important setting for me is the build timeout setting which is not available in the azure portal. Since my Image build takes more than the predefined 4 hours to complete, I needed to increase the timeout in the template:

https://learn.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json?tabs=json%2Cazure-powershell#properties-buildtimeoutinminutes

Autorun

Depending on your implementation, autorun can also be really helpful for you to automatically start the build process when the template is deployed:

https://learn.microsoft.com/en-us/azure/virtual-machines/linux/image-builder-json?tabs=json%2Cazure-powershell#properties-autorun

Conclusion

The combination of Azure VM Image Builder and a CI/CD Pipeline makes the solution complete for me and allows us to build reproduceable images with full version control from the template to the images and takes out the fear of having to managed golden images (again).

About the author

T-Bone Granheden

Solutions Architect at Coligo AB | Microsoft MVP in Enterprise Mobility and Azure Virtual Desktop

T. Granheden (08/09/2026) Using Azure Image Builder to build your custom VM Images – Part 3 – Mike’s MDM Blog