Azure ARM Template now supports IF

Ryan Jones at Microsoft recently announced that Azure ARM Templates now support If(). This is a really nice addition that will simplify ARM templates that require deployment of resources based on conditions.

You can view the full sample at this link https://github.com/rjmax/ArmExamples/blob/master/if.AvailabilitySet.json .

In the sample provided this is implemented by providing a Parameter for AvailabilitySet with allowedValues “Yes” and “No” :

Then within the Virtual Machine Resource properties, the “availabilitySet” has an If statement that matches to the availabilitySet Parameter ‘Yes’, and if Yes will deploy the VM into the availabilitySet defined in the variable “availabilitySet”: