ARM template functions
This article describes all the functions you can use in an Azure Resource Manager template (ARM template). For information about using functions in your template, see template syntax.
To create your own functions, see User-defined functions.
Most functions work the same when deployed to a resource group, subscription, management group, or tenant. A few functions can't be used in all scopes. They're noted in the lists below.
Tip
We recommend Bicep because it offers the same capabilities as ARM templates and the syntax is easier to use. To learn more, see Bicep functions and Bicep operators.
Any function
The any function is available in Bicep to help resolve issues around data type warnings.
Array functions
Resource Manager provides several functions for working with arrays.
- array
- concat
- contains
- createArray
- empty
- first
- indexOf
- intersection
- last
- lastIndexOf
- length
- max
- min
- range
- skip
- take
- union
For Bicep files, use the array functions.
CIDR functions
The following functions are available for working with CIDR. All of these functions are in the sys
namespace.
Comparison functions
Resource Manager provides several functions for making comparisons in your templates.
For Bicep files, use the coalesce logical operator. For comparisons, use the comparison operators.
Date functions
Resource Manager provides the following functions for working with dates.
For Bicep files, use the date functions.
Deployment value functions
Resource Manager provides the following functions for getting values from sections of the template and values related to the deployment:
For Bicep files, use the deployment functions.
Lambda functions
Resource Manager provides the following functions for working with lambda expressions.
For Bicep files, use the lambda functions.
Logical functions
Resource Manager provides the following functions for working with logical conditions:
For Bicep files, use the bool logical function. For other logical values, use logical operators.
Numeric functions
Resource Manager provides the following functions for working with integers:
For Bicep files that use int
, min
, and max
use numeric functions. For other numeric values, use numeric operators.
Object functions
Resource Manager provides several functions for working with objects.
For Bicep files, use the object functions.
Resource functions
Resource Manager provides the following functions for getting resource values:
resourceId - can be used at any scope, but the valid parameters change depending on the scope.
For Bicep files, use the resource functions.
Scope functions
Resource Manager provides the following functions for getting deployment scope values:
- managementGroup - can only be used in deployments to a management group.
- resourceGroup - can only be used in deployments to a resource group.
- subscription - can only be used in deployments to a resource group or subscription.
- tenant - can be used for deployments at any scope.
For Bicep files, use the scope functions.
String functions
Resource Manager provides the following functions for working with strings:
- base64
- base64ToJson
- base64ToString
- concat
- contains
- dataUri
- dataUriToString
- empty
- endsWith
- first
- format
- guid
- indexOf
- join
- json
- last
- lastIndexOf
- length
- newGuid
- padLeft
- replace
- skip
- split
- startsWith
- string
- substring
- take
- toLower
- toUpper
- trim
- uniqueString
- uri
- uriComponent
- uriComponentToString
For Bicep files, use the string functions.
Next steps
- For a description of the sections in an ARM template, see Understand the structure and syntax of ARM templates.
- To merge multiple templates, see Using linked and nested templates when deploying Azure resources.
- To iterate a specified number of times when creating a type of resource, see Resource iteration in ARM templates.
- To see how to deploy the template you've created, see Deploy resources with ARM templates and Azure PowerShell.