Skip to content

Commit def19f2

Browse files
authored
Merge pull request #204432 from mumian/0711-extension-resource
cross-sub/RG deployments are not supported for individual resources
2 parents bcb3f24 + c584d7a commit def19f2

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

articles/azure-resource-manager/bicep/scope-extension-resources.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Scope on extension resource types (Bicep)
33
description: Describes how to use the scope property when deploying extension resource types with Bicep.
44
ms.topic: conceptual
5-
ms.date: 02/11/2022
5+
ms.date: 07/12/2022
66
---
77

88
# Set scope for extension resources in Bicep
@@ -138,6 +138,44 @@ The same requirements apply to extension resources as other resource when target
138138
* [Management group deployments](deploy-to-management-group.md)
139139
* [Tenant deployments](deploy-to-tenant.md)
140140

141+
The resourceGroup and subscription properties are only allowed on modules. These properties are not allowed on individual resources. Use modules if you want to deploy an extension resource with the scope set to a resource in a different resource group.
142+
143+
The following example shows how to apply a lock on a storage account that resides in a different resource group.
144+
145+
* **main.bicep:**
146+
147+
```bicep
148+
param resourceGroup2Name string
149+
param storageAccountName string
150+
151+
module applyStoreLock './storageLock.bicep' = {
152+
name: 'addStorageLock'
153+
scope: resourceGroup(resourceGroup2Name)
154+
params: {
155+
storageAccountName: storageAccountName
156+
}
157+
}
158+
```
159+
160+
* **storageLock.bicep:**
161+
162+
```bicep
163+
param storageAccountName string
164+
165+
resource storage 'Microsoft.Storage/storageAccounts@2021-09-01' existing = {
166+
name: storageAccountName
167+
}
168+
169+
resource storeLock 'Microsoft.Authorization/locks@2017-04-01' = {
170+
scope: storage
171+
name: 'storeLock'
172+
properties: {
173+
level: 'CanNotDelete'
174+
notes: 'Storage account should not be deleted.'
175+
}
176+
}
177+
```
178+
141179
## Next steps
142180
143181
For a full list of extension resource types, see [Resource types that extend capabilities of other resources](../management/extension-resource-types.md).

articles/azure-resource-manager/templates/scope-extension-resources.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Scope on extension resource types
33
description: Describes how to use the scope property when deploying extension resource types.
44
ms.topic: conceptual
5-
ms.date: 01/13/2021
5+
ms.date: 07/11/2022
66
ms.custom: devx-track-azurepowershell, devx-track-azurecli
77
---
88

@@ -79,6 +79,8 @@ The following example creates a storage account and applies a role to it.
7979

8080
:::code language="json" source="~/resourcemanager-templates/azure-resource-manager/scope/storageandrole.json" highlight="56":::
8181

82+
The resourceGroup and subscription properties are only allowed on nested or linked deployments. These properties are not allowed on individual resources. Use nested or linked deployments if you want to deploy an extension resource with the scope set to a resource in a different resource group.
83+
8284
## Next steps
8385

8486
* To understand how to define parameters in your template, see [Understand the structure and syntax of ARM templates](./syntax.md).

0 commit comments

Comments
 (0)