title | description | ms.topic | ms.custom | ms.date |
---|---|---|---|---|
Template functions |
Describes the functions to use in an Azure Resource Manager template (ARM template) to retrieve values, work with strings and numerics, and retrieve deployment information. |
conceptual |
devx-track-arm-template |
05/10/2024 |
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.
The any function is available in Bicep to help resolve issues around data type warnings.
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.
The following functions are available for working with CIDR. All of these functions are in the sys
namespace.
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.
Resource Manager provides the following functions for working with dates.
For Bicep files, use the date 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.
Resource Manager provides the following functions for working with lambda expressions.
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.
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.
Resource Manager provides several functions for working with objects.
For Bicep files, use the object functions.
Resource Manager provides the following functions for getting resource values:
- extensionResourceId
- listAccountSas
- listKeys
- listSecrets
- list*
- pickZones
- providers (deprecated)
- reference
- references
- resourceId - can be used at any scope, but the valid parameters change depending on the scope.
- subscriptionResourceId
- tenantResourceId
For Bicep files, use the resource 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.
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.
- 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.