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
- Integrating Microsoft Defender with Cloud App Security
- New from Microsoft: Azure Security Center onboarding guide
- Fixing Azure Key Vault when moving to a different tenant
- Restore Azure Key Vault using just two PowerShell cmdlets
- This overlooked feature in Visual Studio Code can speed release time