Running Packer in Azure Pipelines
To start our IaC pipeline, we will automatically create an Azure VM image using Packer. To perform this operation, we will use Azure Pipelines with a pipeline in YAML format. The goal of this pipeline is to execute a Packer command automatically.
Important Note
For more details on how to create a YAML pipeline in Azure DevOps, read Chapter 7, Continuous Integration and Continuous Delivery.
The Packer template that we will use in this section's lab is the code that we learned in Chapter 4, Optimizing Infrastructure Deployment with Packer. This source code is available here: https://github.com/PacktPublishing/Learning-DevOps-Second-Edition/blob/main/CHAP08/packer/.pkr.hcl.
Before we start using Packer, we need first to create an Azure resource group that will store the created VM image by the pipeline. In our lab, we named this Azure resource group rg_images
. The following screenshot shows the Azure resource group: