How to use Packer to build a Windows Server Image for Azure
Packer is an open-source tool used to create virtual machine templates from a .json file.
In this story, we will learn how to use Packer to define and build custom images in Azure, and then use this image to build a Windows virtual machine using Terraform.
1. Prerequisites
To create our own custom virtual machine images in Azure with Packer, we will need Packer (pretty obvious) and a couple of resources in Azure.
1.1. Packer
Packer is available to download at https://www.packer.io as a single binary file.
We can download Packer binary for macOS, Linux, or Windows from the Packer web site
We can install on macOS using Homebrew by executing brew install packer
We can install on Linux using apt-get by executing apt-get install packer
1.2. How to Install Packer in Windows?
The process is very simple.
- Download the .zip file from https://www.packer.io/downloads.html
- Extract the .ZIP file to a folder
- Add the folder to the path variable