Understanding expressions
Azure Bicep supports a variety of expressions and operators that will help you create more dynamic templates and flows within your deployment, whether it is to decide which resource gets deployed and which ones do not, or when you are accessing elements within an object or array to calculate values.
Let's start with unary operators.
Unary operators
There are two unary operators, unary NOT (!
) and unary minus (-
), both of which operate on a single operand.
Unary NOT
This operator negates the specified value and is equivalent to the not
function in ARM templates. Here is an example:
param isProd bool = true var shouldDeployFirewall = !isProd
In the preceding code snippet, the value of the shouldDeployFirewall
variable would be false
, which can be used later to decide whether to deploy a firewall or not.
Unary minus
This operator multiplies the operand by -1
. The result of applying this operator to a positive integer returns a...