Pipeline Config

Now that the packer template is ready we can run it with packer from our WSL but this limits the work to our computer so in order to schedule a recurring build and for team collaboration we can use Azure DevOps and create a pipeline with Packer and our template.

Pipeline with 2 steps to install packer and to run the template

You can use Azure hosted agents for cost savings since these are ephemeral containers that are destroyed after the build is finished. The first step called Use Packer installs packer in the self hosted agent. The second step tells the agent to run packer with our created template. Take notice at the template parameters since we are specifying the variables to use for secrets.

Use secrets from Azure Vault.

We create the secrets in Azure Vault and then link the variable group with an SPN that roles to at least read secrets

Azure Key Vault for secrets management

If you are not familiar with Azure Key vault checkout this link on how to configure it for your pipelines: https://docs.microsoft.com/en-us/azure/devops/pipelines/release/azure-key-vault?view=azure-devops

The last step is to run the pipeline

Running an Azure pipeline

You can monitor the steps of the pipeline to make sure all goes well the first few runs