Building VM images in Azure using Packer and Deploying with Terraform, in an Azure DevOps pipeline!
Deploying a VM in Azure is all well and good, but what about the base configuration of the VM itself? That's where Packer comes in, enabling a custom image to be created and configured with server roles, applications, packages, etc. as required. That custom image can then be used to build your virtual machines. Creating it using Packer enables the benefits of infrastructure as code, which can be source control managed and tracked.
In this article, I’ll show how to create a Packer image that simply has the AD DS and DNS server roles added to a base Windows 2019 datacenter image from the Azure Marketplace. This image is then used to deploy a VM using Terraform.