Skip to content

Commit f02ce35

Browse files
authored
Merge pull request #295045 from mumian/0220-bcp-135
Add BCP135
2 parents 32f3b38 + a813611 commit f02ce35

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

articles/azure-resource-manager/bicep/bicep-core-diagnostics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ If you need more information about a particular diagnostic code, select the **Fe
138138
| <a id='BCP130' />BCP130 | Error | Decorators aren't allowed here. |
139139
| <a id='BCP132' />[BCP132](./diagnostics/bcp132.md) | Error | Expected a declaration after the decorator. |
140140
| <a id='BCP133' />BCP133 | Error | The unicode escape sequence isn't valid. Valid unicode escape sequences range from \\u{0} to \\u{10FFFF}. |
141-
| <a id='BCP134' />BCP134 | Warning | Scope {ToQuotedString(LanguageConstants.GetResourceScopeDescriptions(suppliedScope))} isn't valid for this module. Permitted scopes: {ToQuotedString(LanguageConstants.GetResourceScopeDescriptions(supportedScopes))}. |
142-
| <a id='BCP135' />BCP135 | Warning | Scope {ToQuotedString(LanguageConstants.GetResourceScopeDescriptions(suppliedScope))} isn't valid for this resource type. Permitted scopes: {ToQuotedString(LanguageConstants.GetResourceScopeDescriptions(supportedScopes))}. |
141+
| <a id='BCP134' />BCP134 | Error | Scope \<scope-name> isn't valid for this module. Permitted scopes: \<scope-name>. |
142+
| <a id='BCP135' />[BCP135](./diagnostics/bcp135.md) | Error | Scope \<scope-name> isn't valid for this resource type. Permitted scopes: \<scope-name>. |
143143
| <a id='BCP136' />BCP136 | Error | Expected a loop item variable identifier at this location. |
144144
| <a id='BCP137' />BCP137 | Error | Loop expected an expression of type "{LanguageConstants.Array}" but the provided value is of type "{actualType}". |
145145
| <a id='BCP138' />BCP138 | Error | For-expressions aren't supported in this context. For-expressions may be used as values of resource, module, variable, and output declarations, or values of resource and module properties. |
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: BCP135
3+
description: Scope <scope-name> isn't valid for this resource type. Permitted scopes <scope-name>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 02/20/2025
7+
---
8+
9+
# Bicep diagnostic code - BCP135
10+
11+
In Bicep, scopes determine the hierarchical level at which resources are deployed within Azure. ARM provides four deployment scopes—resource group, management group, subscription, and tenant. Resources must be deployed within the allowed scopes. For more information, see [Deployment scope](../deploy-to-resource-group.md#deployment-scopes).
12+
13+
## Description
14+
15+
Scope \<scope-name> isn't valid for this resource type. Permitted scopes: \<scope-name>.
16+
17+
## Level
18+
19+
Error
20+
21+
## Solutions
22+
23+
Deploy resources to the permitted scopes.
24+
25+
## Examples
26+
27+
The following example raises the diagnostic because `storageAccounts` can't be deployed at the management group scope.
28+
29+
```bicep
30+
targetScope = 'managementGroup'
31+
32+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
33+
name: 'demostorage0220'
34+
location: 'eastus'
35+
sku: {
36+
name: 'Standard_LRS'
37+
}
38+
kind: 'StorageV2'
39+
}
40+
```
41+
42+
You can fix the diagnostic by setting the `targetScope` to `resourceGroup`.
43+
44+
```bicep
45+
targetScope = 'resourceGroup'
46+
47+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = {
48+
name: 'demostorage0220'
49+
location: 'eastus'
50+
sku: {
51+
name: 'Standard_LRS'
52+
}
53+
kind: 'StorageV2'
54+
}
55+
56+
```
57+
58+
## Next steps
59+
60+
For more information about Bicep diagnostics, see [Bicep core diagnostics](../bicep-core-diagnostics.md).

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,8 @@
681681
href: diagnostics/bcp129.md
682682
- name: BCP132
683683
href: diagnostics/bcp132.md
684+
- name: BCP135
685+
href: diagnostics/bcp135.md
684686
- name: BCP139
685687
href: diagnostics/bcp139.md
686688
- name: BCP147

0 commit comments

Comments
 (0)