creates a base image for Azure based on ubuntu 18.04 LTS utilising Packer in a Azure DevOps Pipeline.
- more flexibel variables in .json
- instructions for MSI
- az cli enabled machine
- Fork / Clone the repository
- customize the ubuntu1804.json according to your needs.
- Create a new project @ https://devops.azure.com
- Create a Service Connection (based on Service principal) in the Azure DevOps
Project settings > Service connections > New service connection
Select Azure Resource Manager
, Service Principal Authentication.
here make sure to select "use full version of the service connection".
Keep this window open, please.
You will need to create a SP Client ID and principal key in parallel. using azure cli the can be done as followed:
az account show
az ad sp create-for-rbac -n "packer-4711" --role contributor --scopes /subscriptions/YOURSUBSCRIPTIONIDGOESHERE
copy the app id into the "Service principal client ID" field and the key correspondingly into "Service principal key". Use "verify connection" ...
- Azure Account set up.
- az cli tool installed.
- you can make use of the azure-setup.sh script below, to easily enable local packer development.
- for non-exploratory use make sure to used managed service identities. TODO LINK
- set up env vars see .packer_profile.sample TODO LINK
- customize the ubuntu1804.json according to your needs.
- packer validate ubuntu1804.json
- packer run ubuntu1804.json
lookup the corresponding azure source images in your region e.g.
#ubuntu
az vm image list --all -p Canonical -f UbuntuServer -s 18.04-LTS --location westeurope --all --output table
#windows
az vm image list --publisher MicrosoftWindowsServer --offer WindowsServer --location westeurope --all --output table
https://github.com/hashicorp/packer/blob/master/contrib/azure-setup.sh