Skip to content
/ Packer-Azure Public template

Contains Packer files I have created for Microsoft Azure - Mostly for Labs/Testing and a range of uses, but also includes documentation and guidance.

Notifications You must be signed in to change notification settings

jakewalsh90/Packer-Azure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 

Repository files navigation

Packer

Packer deployment files for Azure

How to use the files in this repo.

  1. Install Packer - I would recommend using Chocolatey to do this:

    choco install packer

    choco install azure-cli

  2. Identify the image you wish to deploy using the Azure CLI. For example, the below finds all the Windows Desktop Offers, and then finds the Windows 11 SKUs - change this as required for your needs/locations:

    az vm image list-offers -l uksouth -p MicrosoftWindowsDesktop --query [].name -o tsv

    az vm image list-skus -l uksouth -f windows-11 -p MicrosoftWindowsDesktop --query [].name -o tsv

  3. Create the required Resource Group for Packer:

    az group create -n packer-images -l uksouth

    az group create -n packer-build -l uksouth

  4. Create a Service Principal for Packer to use:

    az ad sp create-for-rbac --name packer --role contributor --scopes /subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx --query "{ client_id: appId, client_secret: password, tenant_id: tenant }"

This will output something similar to the below:

{ "client_id": “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"client_secret": “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tenant_id": “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" }

Within the packer file you wish to use, you will need to add this information to the file:

  "client_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "subscription_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  1. We are now ready to run Packer. To run packer use the following command:

    ./ packer build packer-file.json

Packer will now run and create your image!

About

Contains Packer files I have created for Microsoft Azure - Mostly for Labs/Testing and a range of uses, but also includes documentation and guidance.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published