title | description | services | documentationcenter | author | manager | editor | ms.assetid | ms.service | ms.devlang | ms.topic | ms.tgt_pltfrm | ms.workload | ms.date | ms.author |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Resource Manager Template Functions | Microsoft Docs |
Describes the functions to use in an Azure Resource Manager template to retrieve values, work with strings and numerics, and retrieve deployment information. |
azure-resource-manager |
na |
tfitzmac |
timlt |
tysonn |
0644abe1-abaa-443d-820d-1966d7d26bfd |
azure-resource-manager |
na |
article |
na |
na |
09/18/2017 |
tomfitz |
This topic describes all the functions you can use in an Azure Resource Manager template.
You add functions in your templates by enclosing them within brackets: [
and ]
, respectively. The expression is evaluated during deployment. While written as a string literal, the result of evaluating the expression can be of a different JSON type, such as an array, object, or integer. Just like in JavaScript, function calls are formatted as functionName(arg1,arg2,arg3)
. You reference properties by using the dot and [index] operators.
A template expression cannot exceed 24,576 characters.
Template functions and their parameters are case-insensitive. For example, Resource Manager resolves variables('var1') and VARIABLES('VAR1') as the same. When evaluated, unless the function expressly modifies case (such as toUpper or toLower), the function preserves the case. Certain resource types may have case requirements irrespective of how functions are evaluated.
Resource Manager provides several functions for working with arrays and objects.
- array
- coalesce
- concat
- contains
- createArray
- empty
- first
- intersection
- json
- last
- length
- min
- max
- range
- skip
- take
- union
Resource Manager provides several functions for making comparisons in your templates.
Resource Manager provides the following functions for getting values from sections of the template and values related to the deployment:
Resource Manager provides the following functions for working with logical conditions:
Resource Manager provides the following functions for working with integers:
Resource Manager provides the following functions for getting resource values:
Resource Manager provides the following functions for working with strings:
- base64
- base64ToJson
- base64ToString
- concat
- contains
- dataUri
- dataUriToString
- empty
- endsWith
- first
- guid
- indexOf
- last
- lastIndexOf
- length
- padLeft
- replace
- skip
- split
- startsWith
- string
- substring
- take
- toLower
- toUpper
- trim
- uniqueString
- uri
- uriComponent
- uriComponentToString
- For a description of the sections in an Azure Resource Manager template, see Authoring Azure Resource Manager templates
- To merge multiple templates, see Using linked templates with Azure Resource Manager
- To iterate a specified number of times when creating a type of resource, see Create multiple instances of resources in Azure Resource Manager
- To see how to deploy the template you have created, see Deploy an application with Azure Resource Manager template