Skip to content

Commit cd44067

Browse files
Merge pull request #294431 from mumian/0206-deployment-scope
add more information for deployment scopes
2 parents b48db7a + 6b7c4a1 commit cd44067

File tree

4 files changed

+46
-41
lines changed

4 files changed

+46
-41
lines changed

articles/azure-resource-manager/bicep/deploy-to-management-group.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: Use Bicep to deploy resources to management group
33
description: Describes how to create a Bicep file that deploys resources at the management group scope.
44
ms.topic: how-to
55
ms.custom: devx-track-bicep
6-
ms.date: 09/26/2024
6+
ms.date: 02/10/2025
77
---
88

99
# Management group deployments with Bicep files
1010

1111
This article describes how to set scope with Bicep when deploying to a management group.
1212

13-
As your organization matures, you can deploy a Bicep file to create resources at the management group level. For example, you may need to define and assign [policies](../../governance/policy/overview.md) or [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md) for a management group. With management group level templates, you can declaratively apply policies and assign roles at the management group level.
13+
As your organization matures, you can deploy a Bicep file to create resources at the management group level. For example, you may need to define and assign [policies](../../governance/policy/overview.md) or [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md) for a management group. With management group level templates, you can declaratively apply policies and assign roles at the management group level. For more information, see [Understand scope](../management/overview.md#understand-scope).
1414

1515
### Training resources
1616

@@ -108,17 +108,19 @@ For each deployment name, the location is immutable. You can't create a deployme
108108

109109
## Deployment scopes
110110

111-
When deploying to a management group, you can deploy resources to:
111+
In a Bicep file, all resources declared with the [`resource`](./resource-declaration.md) keyword must be deployed at the same scope as the deployment. For a management group deployment, this means all `resource` declarations in the Bicep file must be deployed to the same management group or as a child or extension resource of a resource in the same management group as the deployment.
112112

113-
* the target management group from the operation
114-
* another management group in the tenant
115-
* subscriptions in the management group
116-
* resource groups in the management group
117-
* the tenant for the resource group
113+
However, this restriction doesn't apply to [`existing`](./existing-resource.md) resources. You can reference existing resources at a different scope than the deployment.
118114

119-
An [extension resource](scope-extension-resources.md) can be scoped to a target that is different than the deployment target.
115+
To deploy resources at multiple scopes within a single deployment, use [modules](./modules.md). Deploying a module triggers a "nested deployment," allowing you to target different scopes. The user deploying the parent Bicep file must have the necessary permissions to initiate deployments at those scopes.
120116

121-
The user deploying the template must have access to the specified scope.
117+
You can deploy a Bicep module from within a management-group scope Bicep file at the following scopes:
118+
119+
* [The same management group](#scope-to-management-group)
120+
* [Other management groups](#scope-to-management-group)
121+
* [The subscription](#scope-to-subscription)
122+
* [The resource group](#scope-to-resource-group)
123+
* [The tenant](#scope-to-tenant)
122124

123125
### Scope to management group
124126

@@ -128,7 +130,7 @@ To deploy resources to the target management group, add those resources with the
128130
targetScope = 'managementGroup'
129131
130132
// policy definition created in the management group
131-
resource policyDefinition 'Microsoft.Authorization/policyDefinitions@2023-04-01' = {
133+
resource policyDefinition 'Microsoft.Authorization/policyDefinitions@2025-01-01' = {
132134
...
133135
}
134136
```

articles/azure-resource-manager/bicep/deploy-to-resource-group.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ title: Use Bicep to deploy resources to resource groups
33
description: Describes how to deploy resources in a Bicep file. It shows how to target more than one resource group.
44
ms.topic: how-to
55
ms.custom: devx-track-bicep
6-
ms.date: 09/26/2024
6+
ms.date: 02/10/2025
77
---
88

99
# Resource group deployments with Bicep files
1010

11-
This article describes how to set scope with Bicep when deploying to a resource group.
11+
This article describes how to set scope with Bicep when deploying to a resource group. For more information, see [Understand scope](../management/overview.md#understand-scope).
1212

1313
## Supported resources
1414

@@ -62,18 +62,19 @@ For more detailed information about deployment commands and options for deployin
6262

6363
## Deployment scopes
6464

65-
When deploying to a resource group, you can deploy resources to:
65+
In a Bicep file, all resources declared with the [`resource`](./resource-declaration.md) keyword must be deployed at the same scope as the deployment. For a resource group deployment, this means all `resource` declarations in the Bicep file must be deployed to the same resource group or as a child or extension resource of a resource in the same resource group as the deployment.
6666

67-
* the target resource group for the deployment operation
68-
* other resource groups in the same subscription or other subscriptions
69-
* any subscription in the tenant
70-
* the tenant for the resource group
67+
However, this restriction doesn't apply to [`existing`](./existing-resource.md) resources. You can reference existing resources at a different scope than the deployment.
7168

72-
An [extension resource](scope-extension-resources.md) can be scoped to a target that is different than the deployment target.
69+
To deploy resources at multiple scopes within a single deployment, use [modules](./modules.md). Deploying a module triggers a "nested deployment," allowing you to target different scopes. The user deploying the parent Bicep file must have the necessary permissions to initiate deployments at those scopes.
7370

74-
The user deploying the template must have access to the specified scope.
71+
You can deploy a resource from within a resource-group scope Bicep file at the following scopes:
7572

76-
This section shows how to specify different scopes. You can combine these different scopes in a single template.
73+
* [The same resource group](#scope-to-target-resource-group)
74+
* [Other resource groups in the same subscription](#scope-to-different-resource-group)
75+
* [Other resource groups in other subscriptions](#scope-to-different-resource-group)
76+
* [The subscription](#scope-to-subscription)
77+
* [The tenant](#scope-to-tenant)
7778

7879
### Scope to target resource group
7980

@@ -228,7 +229,7 @@ output storageEndpoint object = stg.properties.primaryEndpoints
228229
You can deploy to more than one resource group in a single Bicep file.
229230

230231
> [!NOTE]
231-
> 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.
232+
> 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 doesn't itself deploy any resources, then you can include up to 800 resource groups in nested or linked deployments.
232233
233234
The following example deploys two storage accounts. The first storage account is deployed to the resource group specified in the deployment operation. The second storage account is deployed to the resource group specified in the `secondResourceGroup` and `secondSubscriptionID` parameters:
234235

articles/azure-resource-manager/bicep/deploy-to-subscription.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ title: Use Bicep to deploy resources to subscription
33
description: Describes how to create a Bicep file that deploys resources to the Azure subscription scope.
44
ms.topic: how-to
55
ms.custom: devx-track-bicep
6-
ms.date: 09/26/2024
6+
ms.date: 02/10/2025
77
---
88

99
# Subscription deployments with Bicep files
1010

1111
To simplify the management of resources, you can deploy resources at the level of your Azure subscription. For example, you can deploy [policies](../../governance/policy/overview.md) and [Azure role-based access control (Azure RBAC)](../../role-based-access-control/overview.md) to your subscription, which applies them across your subscription.
1212

13-
This article describes how to set the deployment scope to a subscription in a Bicep file.
13+
This article describes how to set the deployment scope to a subscription in a Bicep file. For more information, see [Understand scope](../management/overview.md#understand-scope).
1414

1515
> [!NOTE]
1616
> You can deploy to 800 different resource groups in a subscription level deployment.
@@ -146,16 +146,18 @@ For each deployment name, the location is immutable. You can't create a deployme
146146

147147
## Deployment scopes
148148

149-
When deploying to a subscription, you can deploy resources to:
149+
In a Bicep file, all resources declared with the [`resource`](./resource-declaration.md) keyword must be deployed at the same scope as the deployment. For a subscription deployment, this means all `resource` declarations in the Bicep file must be deployed to the same subscription or as a child or extension resource of a resource in the same subscription as the deployment.
150150

151-
* the target subscription from the operation
152-
* any subscription in the tenant
153-
* resource groups within the subscription or other subscriptions
154-
* the tenant for the subscription
151+
However, this restriction doesn't apply to [`existing`](./existing-resource.md) resources. You can reference existing resources at a different scope than the deployment.
155152

156-
An [extension resource](scope-extension-resources.md) can be scoped to a target that is different than the deployment target.
153+
To deploy resources at multiple scopes within a single deployment, use [modules](./modules.md). Deploying a module triggers a "nested deployment," allowing you to target different scopes. The user deploying the parent Bicep file must have the necessary permissions to initiate deployments at those scopes.
157154

158-
The user deploying the template must have access to the specified scope.
155+
You can deploy a resource from within a subscription scope Bicep file at the following scopes:
156+
157+
* [The same subscription](#scope-to-subscription)
158+
* [Other subscriptions](#scope-to-subscription)
159+
* [The resource group](#scope-to-resource-group)
160+
* [The tenant](#scope-to-tenant)
159161

160162
### Scope to subscription
161163

@@ -165,7 +167,7 @@ To deploy resources to the target subscription, add those resources with the `re
165167
targetScope = 'subscription'
166168
167169
// resource group created in target subscription
168-
resource exampleResource 'Microsoft.Resources/resourceGroups@2024-03-01' = {
170+
resource exampleResource 'Microsoft.Resources/resourceGroups@2024-11-01' = {
169171
...
170172
}
171173
```

articles/azure-resource-manager/bicep/deploy-to-tenant.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Use Bicep to deploy resources to tenant
33
description: Describes how to deploy resources at the tenant scope in a Bicep file.
44
ms.topic: how-to
55
ms.custom: devx-track-bicep
6-
ms.date: 09/26/2024
6+
ms.date: 02/10/2025
77
---
88

99
# Tenant deployments with Bicep file
@@ -120,18 +120,18 @@ For each deployment name, the location is immutable. You can't create a deployme
120120

121121
## Deployment scopes
122122

123-
When deploying to a tenant, you can deploy resources to:
123+
In a Bicep file, all resources declared with the [`resource`](./resource-declaration.md) keyword must be deployed at the same scope as the deployment. For a tenant deployment, this means all `resource` declarations in the Bicep file must be deployed to the same tenant or as a child or extension resource of a resource in the same tenant as the deployment.
124124

125-
* the tenant
126-
* management groups within the tenant
127-
* subscriptions
128-
* resource groups
125+
However, this restriction doesn't apply to [`existing`](./existing-resource.md) resources. You can reference existing resources at a different scope than the deployment.
129126

130-
An [extension resource](scope-extension-resources.md) can be scoped to a target that is different than the deployment target.
127+
To deploy resources at multiple scopes within a single deployment, use [modules](./modules.md). Deploying a module triggers a "nested deployment," allowing you to target different scopes. The user deploying the parent Bicep file must have the necessary permissions to initiate deployments at those scopes.
131128

132-
The user deploying the template must have access to the specified scope.
129+
You can deploy a resource from within a tenant scope Bicep file at the following scopes:
133130

134-
This section shows how to specify different scopes. You can combine these different scopes in a single template.
131+
* [The tenant](#scope-to-tenant)
132+
* [The management group](#scope-to-management-group)
133+
* [The subscription](#scope-to-subscription)
134+
* [The resource group](#scope-to-resource-group)
135135

136136
### Scope to tenant
137137

0 commit comments

Comments
 (0)