Understanding Helper Functions in ARM Templates

ARM Templates has various dynamic constructs called Helper Functions which can make your template more generic. These constructs reduce the hard coded values in your templates. You can use the information from this blog to make your existing templates more dynamic and start writing new templates with a much generic approach.

Let’s look at the most important helper functions and their practical usage one by one.

1. Resource Id – Resource Function

You use this function to determine the ID of a resource. This is only used when the resource (whose ID is needed) is not being deployed in the current template and it already exists in Azure.

The generic syntax to use this is:

Only required parameters of this helper function are resourceType and resourceName1.

These parameters are as follows:

  • subscription ID – This is only needed if you want to refer a different subscription. Default value is the current subscription
  • resource Group Name – Name of the resource group where the resource exists. Default is the current resource group, in which you are deploying the template
  • resource Type – Type of resource including resource provider namespace
  • resource Name 1 – Name of the resource
  • resource Name 2 – Next resource name segment if resource is nested. E.g. a VM Extension

To check the example and understand other helper functions, head to the complete post here.

Leave a Reply