You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-expressions.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Template syntax and expressions
3
3
description: Describes the declarative JSON syntax for Azure Resource Manager templates.
4
4
ms.topic: conceptual
5
-
ms.date: 02/10/2020
5
+
ms.date: 02/13/2020
6
6
---
7
7
8
8
# Syntax and expressions in Azure Resource Manager templates
@@ -11,11 +11,9 @@ The basic syntax of the template is JSON. However, you can use expressions to ex
11
11
12
12
A template expression can't exceed 24,576 characters.
13
13
14
-
Expressions support json('null') and properties support a literal value of null. In both cases, Resource Manager templates treat it as if the property is not present.
15
-
16
14
## Use functions
17
15
18
-
The following example shows an expression in the default value of a parameter:
16
+
Azure Resource Manager provides [functions](template-functions.md) that you can use in a template. The following example shows an expression that uses a function in the default value of a parameter:
19
17
20
18
```json
21
19
"parameters": {
@@ -36,6 +34,12 @@ To pass a string value as a parameter to a function, use single quotes.
Most functions work the same whether deployed to a resource group, subscription, management group, or tenant. The following functions have restrictions based on the scope:
38
+
39
+
*[resourceGroup](template-functions-resource.md#resourcegroup) - can only be used in deployments to a resource group.
40
+
*[resourceId](template-functions-resource.md#resourceid) - can be used at any scope, but the valid parameters change depending on the scope.
41
+
*[subscription](template-functions-resource.md#subscription) - can only be used in deployments to a resource group or subscription.
42
+
39
43
## Escape characters
40
44
41
45
To have a literal string start with a left bracket `[` and end with a right bracket `]`, but not have it interpreted as an expression, add an extra bracket to start the string with `[[`. For example, the variable:
@@ -62,6 +66,15 @@ To escape double quotes in an expression, such as adding a JSON object in the te
62
66
},
63
67
```
64
68
69
+
## Null values
70
+
71
+
To set a property to null, you can use **null** or **[json('null')]**. The [json function](template-functions-array.md#json) returns an empty object when you provide `null` as the parameter. In both cases, Resource Manager templates treat it as if the property is not present.
72
+
73
+
```json
74
+
"stringValue": null,
75
+
"objectValue": "[json('null')]"
76
+
```
77
+
65
78
## Next steps
66
79
67
80
* For the full list of template functions, see [Azure Resource Manager template functions](template-functions.md).
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-functions-resource.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -753,7 +753,7 @@ Returns the unique identifier of a resource. You use this function when the reso
753
753
754
754
| Parameter | Required | Type | Description |
755
755
|:--- |:--- |:--- |:--- |
756
-
| subscriptionId |No |string (In GUID format) |Default value is the current subscription. Specify this value when you need to retrieve a resource in another subscription. |
756
+
| subscriptionId |No |string (In GUID format) |Default value is the current subscription. Specify this value when you need to retrieve a resource in another subscription. Only provide this value when deploying at the scope of a resource group or subscription. |
757
757
| resourceGroupName |No |string |Default value is current resource group. Specify this value when you need to retrieve a resource in another resource group. Only provide this value when deploying at the scope of a resource group. |
758
758
| resourceType |Yes |string |Type of resource including resource provider namespace. |
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/templates/template-functions.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,14 +2,16 @@
2
2
title: Template functions
3
3
description: Describes the functions to use in an Azure Resource Manager template to retrieve values, work with strings and numerics, and retrieve deployment information.
4
4
ms.topic: conceptual
5
-
ms.date: 11/19/2019
5
+
ms.date: 02/13/2020
6
6
---
7
7
# Azure Resource Manager template functions
8
8
9
9
This article describes all the functions you can use in an Azure Resource Manager template. For information about using functions in your template, see [template syntax](template-expressions.md).
10
10
11
11
To create your own functions, see [User-defined functions](template-syntax.md#functions).
12
12
13
+
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.
14
+
13
15
<aid="array"aria-hidden="true" />
14
16
<aid="coalesce"aria-hidden="true" />
15
17
<aid="concatarray"aria-hidden="true" />
@@ -29,6 +31,7 @@ To create your own functions, see [User-defined functions](template-syntax.md#fu
29
31
<aid="union"aria-hidden="true" />
30
32
31
33
## Array and object functions
34
+
32
35
Resource Manager provides several functions for working with arrays and objects.
33
36
34
37
*[array](template-functions-array.md#array)
@@ -56,6 +59,7 @@ Resource Manager provides several functions for working with arrays and objects.
56
59
<aid="greaterorequals"aria-hidden="true" />
57
60
58
61
## Comparison functions
62
+
59
63
Resource Manager provides several functions for making comparisons in your templates.
0 commit comments