Skip to content

Commit

Permalink
clarified resourceGroup use
Browse files Browse the repository at this point in the history
  • Loading branch information
tfitzmac committed Jun 5, 2017
1 parent 82fcda7 commit 66ea204
Showing 1 changed file with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ms.devlang: na
ms.topic: article
ms.tgt_pltfrm: na
ms.workload: na
ms.date: 05/22/2017
ms.date: 06/05/2017
ms.author: tomfitz

---
Expand Down Expand Up @@ -113,6 +113,42 @@ az group deployment create \

After deployment completes, you see two resource groups. Each resource group contains a storage account.

## Use resourceGroup() function

For cross resource group deployments, the [resouceGroup() function](resource-group-template-functions-resource.md#resourcegroup) resolves differently based on how you specify the nested template.

If you embed one template within another template, resouceGroup() in the nested template resolves to the parent resource group. An embedded template uses the following format:

```json
"apiVersion": "2017-05-10",
"name": "embeddedTemplate",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "crossResourceGroupDeployment",
"properties": {
"mode": "Incremental",
"template": {
...
resourceGroup() refers to parent resource group
}
}
```

If you link to a separate template, resouceGroup() in the linked template resolves to the nested resource group. A linked template uses the following format:

```json
"apiVersion": "2017-05-10",
"name": "linkedTemplate",
"type": "Microsoft.Resources/deployments",
"resourceGroup": "crossResourceGroupDeployment",
"properties": {
"mode": "Incremental",
"templateLink": {
...
resourceGroup() in linked template refers to linked resource group
}
}
```

## Next steps

* To understand how to define parameters in your template, see [Understand the structure and syntax of Azure Resource Manager templates](resource-group-authoring-templates.md).
Expand Down

0 comments on commit 66ea204

Please sign in to comment.