When working with multiple environments in Azure DevOps pipelines, one of the approaches is to have a parameter file for each environment. The code itself will be the same, and we tweak the ending result by changing the parameters file that matches the environment. In the image depicted below, we have our security.json, which is the ARM template with the code, and we have the parameters file named security.prod.json, where the prod string is the one that defines the environment.
When creating your Azure DevOps pipelines, if we label our stages correctly with the environment name, we can leverage it when defining the template parameters section. When we copy and paste stages, it will always work, as long as we change the stage name to match the string on our parameter files.
To reference the stage name, use $(Release.EnvironmentName).
More Quick Tips articles
- How to delete a sprint when using Azure DevOps
- IaaS VM ‘cheat sheets’ available in Azure Portal
- Finding Azure locations with PowerShell
- Check if Azure Key Vault certificate uses exportable private keys
- Managing access to your Azure invoices