Variables
Variables comes into play when you do not have a straightforward value but rather a complicated expression. Instead of repeating this complex expression within your Bicep files even if it is just one time, you can define a variable that contains this expression. Then use the variable anywhere you need that value within your template.
Azure Resource Manager will resolve the value right before starting the deployment, then replace any occurrence of the variable with that value. So let's see how you define variables.
Defining variables
Unlike parameters, you do not need to provide a type when defining variables:
var storageAccountName = 'name'
You start with the reserved keyword var
, then a name for your variable, and finally the value you want to assign to it. You can have variables of any type within your template:
var isProd = true var appServicePlanInstanceCount = 5 var storageSkus = createArray('Standard_LRS', 'Standard_ZRS...