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/resource-group-linked-templates.md
+98-33Lines changed: 98 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,53 +18,118 @@ For a tutorial, see [Tutorial: create linked Azure Resource Manager templates](.
18
18
19
19
## Nested template
20
20
21
-
To create a nested template, add the[deployments resource type](/azure/templates/microsoft.resources/2019-08-01/deployments) to the parent template, and embed all of the template syntax within the resource. To nest the template within the main template, use the **template** property and specify the template syntax.
21
+
To nest a template, add a[deployments resource](/azure/templates/microsoft.resources/deployments) to your main template. In the **template** property, specify the template syntax.
When using a nested template, you must specify whether template expressions are evaluated within the scope of the parent template or the nested template. For example, the preceding example uses a parameter named `storageName`. You can specify whether that parameter comes from the parent template or the nested template. You set the scope through the `expressionEvaluationOptions` property. By default, the `expressionEvaluationOptions` property is set to `outer`, which means it uses the parent template scope.
47
+
When using a nested template, you must specify whether template expressions are evaluated within the scope of the parent template or the nested template. You set the scope through the `expressionEvaluationOptions` property. By default, the `expressionEvaluationOptions` property is set to `outer`, which means it uses the parent template scope. Set the value to `inner` to scope expressions to the nested template.
48
+
49
+
The following template demonstrates how template expressions are resolved according to the scope. It contains a variable named `exampleVar` in the parent template and the nested template. When scope is set to `inner`, it returns `from nested template`. If you changed scope to `outer`, it would return `from parent template`.
> You can't use the `reference` function in the outputs section of a nested template for a resource you have deployed in the nested template. To return the values for a deployed resource in a nested template, convert your nested template to a linked template.
100
+
> When scope is set to `outer`, you can't use the `reference` function in the outputs section of a nested template for a resource you have deployed in the nested template. To return the values for a deployed resource in a nested template, either use inner scope or convert your nested template to a linked template.
60
101
61
102
The nested template requires the [same properties](resource-group-authoring-templates.md) as a standard template.
62
103
63
104
## Linked template
64
105
65
-
To link to an external template, use the **templateLink** property. You can't specify a local file or a file that is only available on your local network. You can only provide a URI value that includes either **http** or **https**. Resource Manager must be able to access the template.
106
+
To link a template, add a [deployments resource](/azure/templates/microsoft.resources/deployments) to your main template. In the **templateLink** property, specify the URI of the template to include.
One option is to place your linked template in a storage account, and use the URI for that item.
132
+
You can't specify a local file or a file that is only available on your local network. You can only provide a URI value that includes either **http** or **https**. Resource Manager must be able to access the template. One option is to place your linked template in a storage account, and use the URI for that item.
68
133
69
134
You can provide the parameters for your external template either in an external file or inline.
70
135
@@ -347,7 +412,7 @@ To use the public IP address from the preceding template when deploying a load b
347
412
348
413
## Deployment history
349
414
350
-
Resource Manager processes each template as a separate deployment in the deployment history. Therefore, a main template with three linked or nested templates appears in the deployment history as:
415
+
Resource Manager processes each template as a separate deployment in the deployment history. A main template with three linked or nested templates appears in the deployment history as:
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/resource-group-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
@@ -477,7 +477,7 @@ Use `'Full'` when you need resource values that aren't part of the properties sc
477
477
478
478
The reference function can only be used in the properties of a resource definition and the outputs section of a template or deployment. When used with [property iteration](resource-group-create-multiple.md#property-iteration), you can use the reference function for `input` because the expression is assigned to the resource property. You can't use it with `count` because the count must be determined before the reference function is resolved.
479
479
480
-
You can't use the reference function in the outputs of a [nested template](resource-group-linked-templates.md#nested-template) to return a resource you've deployed in the nested template. Instead, use a [linked template](resource-group-linked-templates.md#external-template).
480
+
You can't use the reference function in the outputs of a [nested template](resource-group-linked-templates.md#nested-template) to return a resource you've deployed in the nested template. Instead, use a [linked template](resource-group-linked-templates.md#linked-template).
481
481
482
482
If you use the **reference** function in a resource that is conditionally deployed, the function is evaluated even if the resource isn't deployed. You get an error if the **reference** function refers to a resource that doesn't exist. Use the **if** function to make sure the function is only evaluated when the resource is being deployed. See the [if function](resource-group-template-functions-logical.md#if) for a sample template that uses if and reference with a conditionally deployed resource.
0 commit comments