Редактиране

Споделяне чрез


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.

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:

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:

For Bicep files, use the string functions.

Next steps