Skip to content

Commit 3508506

Browse files
committed
updates
1 parent 9acae3d commit 3508506

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

articles/azure-resource-manager/resource-group-linked-templates.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
title: Link templates for deployment
33
description: Describes how to use linked templates in an Azure Resource Manager template to create a modular template solution. Shows how to pass parameters values, specify a parameter file, and dynamically created URLs.
44
ms.topic: conceptual
5-
ms.date: 12/10/2019
5+
ms.date: 12/11/2019
66
---
77
# Using linked and nested templates when deploying Azure resources
88

9-
To deploy complex solutions, you can break your template into many related templates. You create a main template that connects all of the related templates, and deploy that main template. The related templates can be separate files or template syntax that is embedded within the main template. This article uses the term **linked template** to refer to a separate template file that is linked to from the main template. It uses the term **nested template** to refer to embedded template syntax within the main template.
9+
To deploy complex solutions, you can break your template into many related templates, and then deploy them together through a main template. The related templates can be separate files or template syntax that is embedded within the main template. This article uses the term **linked template** to refer to a separate template file that is linked to from the main template. It uses the term **nested template** to refer to embedded template syntax within the main template.
1010

1111
For small to medium solutions, a single template is easier to understand and maintain. You can see all the resources and values in a single file. For advanced scenarios, linked templates enable you to break down the solution into targeted components. You can easily reuse these templates for other scenarios.
1212

@@ -86,11 +86,23 @@ The following example deploys a storage account through a nested template.
8686
}
8787
```
8888

89-
## Scope for expressions in nested templates
89+
### Scope for expressions in nested templates
9090

91-
When using a nested template, you must specify whether template expressions are evaluated within the scope of the parent template or the nested template. The scope determines how parameters, variables, and functions like [resourceGroup](resource-group-template-functions-resource.md#resourcegroup) and [subscription](resource-group-template-functions-resource.md#subscription) are resolved.
91+
When using a nested template, you can specify whether template expressions are evaluated within the scope of the parent template or the nested template. The scope determines how parameters, variables, and functions like [resourceGroup](resource-group-template-functions-resource.md#resourcegroup) and [subscription](resource-group-template-functions-resource.md#subscription) are resolved.
9292

93-
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. In the preceding example, the scope isn't set so the value of the `storageAccountName` parameter is retrieved from the parent template. Set the value to `inner` to scope expressions to the nested template.
93+
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.
94+
95+
```json
96+
{
97+
"apiVersion": "2017-05-10",
98+
"name": "nestedTemplate1",
99+
"type": "Microsoft.Resources/deployments",
100+
"properties": {
101+
"expressionEvaluationOptions": {
102+
"scope": "inner"
103+
},
104+
...
105+
```
94106

95107
The following template demonstrates how template expressions are resolved according to the scope. It contains a variable named `exampleVar` that is defined in both the parent template and the nested template. It returns the value of the variable.
96108

@@ -120,7 +132,6 @@ The following template demonstrates how template expressions are resolved accord
120132
"exampleVar": "from nested template"
121133
},
122134
"resources": [
123-
124135
],
125136
"outputs": {
126137
"testVar": {

0 commit comments

Comments
 (0)