When planning your infrastructure-as-code (IaC) course of, we now have a wide range of methods to deploy a number of environments from a single supply code. Some individuals will use totally different “parameters.json files,” others will use pipeline variables, and there are many methods to get the work completed. On this article, I’ll present the mix of parameters and variables in the ARM template. The attention-grabbing portion of this methodology is that I’m going to obtain a single parameter known as environment, and based mostly on the parameter, I’ll use a selected variable. Have a look at the code under, the place I launched the environment and the v_DEV_sample.
When referencing the variable we will use [variables(concat(‘v_’,parameters(‘environment’),’_Sample’))] and that enables us to assemble the variable utilizing a parameter file. Let’s think about that I had a variable for UAT known as v_UAT_sample. So long as I move the appropriate environment, I’ll get a special worth.
In that case, I used to be deploying an online app, and only for enjoyable, I created a brand new software setting and used that variable that we outlined throughout execution time — and the result’s the right worth for the DEV environment.