Skip to content

Commit c04c5b5

Browse files
committed
update cross rg limit
1 parent 254c1c3 commit c04c5b5

File tree

1 file changed

+9
-185
lines changed

1 file changed

+9
-185
lines changed

articles/azure-resource-manager/templates/cross-resource-group-deployment.md

Lines changed: 9 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -2,113 +2,29 @@
22
title: Deploy resources cross subscription & resource group
33
description: Shows how to target more than one Azure subscription and resource group during deployment.
44
ms.topic: conceptual
5-
ms.date: 12/09/2019
5+
ms.date: 05/18/2020
66
---
77

88
# Deploy Azure resources to more than one subscription or resource group
99

10-
Typically, you deploy all the resources in your template to a single [resource group](../management/overview.md). However, there are scenarios where you want to deploy a set of resources together but place them in different resource groups or subscriptions. For example, you may want to deploy the backup virtual machine for Azure Site Recovery to a separate resource group and location. Resource Manager enables you to use nested templates to target more than one subscription and resource group.
10+
Resource Manager enables you to use nested templates to target more than one subscription and resource group.
1111

1212
> [!NOTE]
13-
> You can deploy to only five resource groups in a single deployment. Typically, this limitation means you can deploy to one resource group specified for the parent template, and up to four resource groups in nested or linked deployments. However, if your parent template contains only nested or linked templates and does not itself deploy any resources, then you can include up to five resource groups in nested or linked deployments.
13+
> You can deploy to 800 resource groups in a single deployment. Typically, this limitation means you can deploy to one resource group specified for the parent template, and up to 799 resource groups in nested or linked deployments. However, if your parent template contains only nested or linked templates and does not itself deploy any resources, then you can include up to 800 resource groups in nested or linked deployments.
1414
1515
## Specify subscription and resource group
1616

17-
To target a different resource group or subscription, use a [nested or linked template](linked-templates.md). The `Microsoft.Resources/deployments` resource type provides parameters for `subscriptionId` and `resourceGroup`, which enable you to specify the subscription and resource group for the nested deployment. If you don't specify the subscription ID or resource group, the subscription and resource group from the parent template is used. All the resource groups must exist before running the deployment.
17+
To target a resource group that is different than the one for parent template, use a [nested or linked template](linked-templates.md). Within the `Microsoft.Resources/deployments` resource type, specify values for the `subscriptionId` and `resourceGroup` properties.
1818

19-
The account you use to deploy the template must have permissions to deploy to the specified subscription ID. If the specified subscription exists in a different Azure Active Directory tenant, you must [add guest users from another directory](../../active-directory/active-directory-b2b-what-is-azure-ad-b2b.md).
19+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/crosssubscription.json" range="38-43" highlight="2,5-6":::
2020

21-
To specify a different resource group and subscription, use:
22-
23-
```json
24-
"resources": [
25-
{
26-
"apiVersion": "2017-05-10",
27-
"name": "nestedTemplate",
28-
"type": "Microsoft.Resources/deployments",
29-
"resourceGroup": "[parameters('secondResourceGroup')]",
30-
"subscriptionId": "[parameters('secondSubscriptionID')]",
31-
...
32-
}
33-
]
34-
```
21+
If you don't specify the subscription ID or resource group, the subscription and resource group from the parent template are used. All the resource groups must exist before running the deployment.
3522

36-
If your resource groups are in the same subscription, you can remove the **subscriptionId** value.
23+
The account you use to deploy the template must have permissions to deploy to the specified subscription ID. If the specified subscription exists in a different Azure Active Directory tenant, you must [add guest users from another directory](../../active-directory/active-directory-b2b-what-is-azure-ad-b2b.md).
3724

3825
The following example deploys two storage accounts. The first storage account is deployed to the resource group specified during deployment. The second storage account is deployed to the resource group specified in the `secondResourceGroup` and `secondSubscriptionID` parameters:
3926

40-
```json
41-
{
42-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
43-
"contentVersion": "1.0.0.0",
44-
"parameters": {
45-
"storagePrefix": {
46-
"type": "string",
47-
"maxLength": 11
48-
},
49-
"secondResourceGroup": {
50-
"type": "string"
51-
},
52-
"secondSubscriptionID": {
53-
"type": "string",
54-
"defaultValue": ""
55-
},
56-
"secondStorageLocation": {
57-
"type": "string",
58-
"defaultValue": "[resourceGroup().location]"
59-
}
60-
},
61-
"variables": {
62-
"firstStorageName": "[concat(parameters('storagePrefix'), uniqueString(resourceGroup().id))]",
63-
"secondStorageName": "[concat(parameters('storagePrefix'), uniqueString(parameters('secondSubscriptionID'), parameters('secondResourceGroup')))]"
64-
},
65-
"resources": [
66-
{
67-
"type": "Microsoft.Storage/storageAccounts",
68-
"apiVersion": "2017-06-01",
69-
"name": "[variables('firstStorageName')]",
70-
"location": "[resourceGroup().location]",
71-
"sku":{
72-
"name": "Standard_LRS"
73-
},
74-
"kind": "Storage",
75-
"properties": {
76-
}
77-
},
78-
{
79-
"type": "Microsoft.Resources/deployments",
80-
"apiVersion": "2017-05-10",
81-
"name": "nestedTemplate",
82-
"resourceGroup": "[parameters('secondResourceGroup')]",
83-
"subscriptionId": "[parameters('secondSubscriptionID')]",
84-
"properties": {
85-
"mode": "Incremental",
86-
"template": {
87-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
88-
"contentVersion": "1.0.0.0",
89-
"parameters": {},
90-
"variables": {},
91-
"resources": [
92-
{
93-
"type": "Microsoft.Storage/storageAccounts",
94-
"apiVersion": "2017-06-01",
95-
"name": "[variables('secondStorageName')]",
96-
"location": "[parameters('secondStorageLocation')]",
97-
"sku":{
98-
"name": "Standard_LRS"
99-
},
100-
"kind": "Storage",
101-
"properties": {
102-
}
103-
}
104-
]
105-
},
106-
"parameters": {}
107-
}
108-
}
109-
]
110-
}
111-
```
27+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/crosssubscription.json":::
11228

11329
If you set `resourceGroup` to the name of a resource group that doesn't exist, the deployment fails.
11430

@@ -216,99 +132,7 @@ The following [example template](https://github.com/Azure/azure-docs-json-sample
216132
* nested template with inner scope
217133
* linked template
218134

219-
```json
220-
{
221-
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
222-
"contentVersion": "1.0.0.0",
223-
"parameters": {},
224-
"variables": {},
225-
"resources": [
226-
{
227-
"type": "Microsoft.Resources/deployments",
228-
"apiVersion": "2017-05-10",
229-
"name": "defaultScopeTemplate",
230-
"resourceGroup": "inlineGroup",
231-
"properties": {
232-
"mode": "Incremental",
233-
"template": {
234-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
235-
"contentVersion": "1.0.0.0",
236-
"parameters": {},
237-
"variables": {},
238-
"resources": [
239-
],
240-
"outputs": {
241-
"resourceGroupOutput": {
242-
"type": "string",
243-
"value": "[resourceGroup().name]"
244-
}
245-
}
246-
},
247-
"parameters": {}
248-
}
249-
},
250-
{
251-
"type": "Microsoft.Resources/deployments",
252-
"apiVersion": "2017-05-10",
253-
"name": "innerScopeTemplate",
254-
"resourceGroup": "inlineGroup",
255-
"properties": {
256-
"expressionEvaluationOptions": {
257-
"scope": "inner"
258-
},
259-
"mode": "Incremental",
260-
"template": {
261-
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
262-
"contentVersion": "1.0.0.0",
263-
"parameters": {},
264-
"variables": {},
265-
"resources": [
266-
],
267-
"outputs": {
268-
"resourceGroupOutput": {
269-
"type": "string",
270-
"value": "[resourceGroup().name]"
271-
}
272-
}
273-
},
274-
"parameters": {}
275-
}
276-
},
277-
{
278-
"type": "Microsoft.Resources/deployments",
279-
"apiVersion": "2017-05-10",
280-
"name": "linkedTemplate",
281-
"resourceGroup": "linkedGroup",
282-
"properties": {
283-
"mode": "Incremental",
284-
"templateLink": {
285-
"contentVersion": "1.0.0.0",
286-
"uri": "https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/resourceGroupName.json"
287-
},
288-
"parameters": {}
289-
}
290-
}
291-
],
292-
"outputs": {
293-
"parentRG": {
294-
"type": "string",
295-
"value": "[concat('Parent resource group is ', resourceGroup().name)]"
296-
},
297-
"defaultScopeRG": {
298-
"type": "string",
299-
"value": "[concat('Default scope resource group is ', reference('defaultScopeTemplate').outputs.resourceGroupOutput.value)]"
300-
},
301-
"innerScopeRG": {
302-
"type": "string",
303-
"value": "[concat('Inner scope resource group is ', reference('innerScopeTemplate').outputs.resourceGroupOutput.value)]"
304-
},
305-
"linkedRG": {
306-
"type": "string",
307-
"value": "[concat('Linked resource group is ', reference('linkedTemplate').outputs.resourceGroupOutput.value)]"
308-
}
309-
}
310-
}
311-
```
135+
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/crossresourcegroupproperties.json":::
312136

313137
To test the preceding template and see the results, use PowerShell or Azure CLI.
314138

0 commit comments

Comments
 (0)