您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure Resource Manager 模板函数Azure Resource Manager template functions

本主题介绍可以在 Azure Resource Manager 模板中使用的所有函数。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. 尽管表达式编写为字符串文本,但其计算结果可以是其他 JSON 类型,例如数组、对象或整数。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. 如同在 JavaScript 中一样,函数调用的格式为 functionName(arg1,arg2,arg3)Just like in JavaScript, function calls are formatted as functionName(arg1,arg2,arg3). 使用点和 [index] 运算符引用属性。You reference properties by using the dot and [index] operators.

模板表达式不能超过 24,576 个字符。A template expression cannot exceed 24,576 characters.

模板函数及其参数不区分大小写。Template functions and their parameters are case-insensitive. 例如,Resource Manager 将 variables('var1')VARIABLES('VAR1') 视为相同。For example, Resource Manager resolves variables('var1') and VARIABLES('VAR1') as the same. 在求值时,除非函数明确修改大小写(例如,使用 toUpper 或 toLower 进行修改),否则函数将保留大小写。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.

数组和对象函数Array and object functions

Resource Manager 提供以下用于处理数组和对象的函数。Resource Manager provides several functions for working with arrays and objects.

比较函数Comparison functions

Resource Manager 提供了多个用于在模板中进行比较的函数。Resource Manager provides several functions for making comparisons in your templates.

部署值函数Deployment value functions

Resource Manager 提供以下函数,用于从与部署相关的模板和值部分获取值:Resource Manager provides the following functions for getting values from sections of the template and values related to the deployment:

逻辑函数Logical functions

资源管理器提供以下用于逻辑条件的函数:Resource Manager provides the following functions for working with logical conditions:

数值函数Numeric functions

Resource Manager 提供以下用于处理整数的函数:Resource Manager provides the following functions for working with integers:

资源函数Resource functions

Resource Manager 提供以下用于获取资源值的函数:Resource Manager provides the following functions for getting resource values:

字符串函数String functions

Resource Manager 提供以下用于处理字符串的函数:Resource Manager provides the following functions for working with strings:

后续步骤Next steps