You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-resource-manager/bicep/bicep-core-diagnostics.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,7 +143,7 @@ If you need more information about a particular diagnostic code, select the **Fe
143
143
| <aid='BCP136' />BCP136 | Error | Expected a loop item variable identifier at this location. |
144
144
| <aid='BCP137' />BCP137 | Error | Loop expected an expression of type "{LanguageConstants.Array}" but the provided value is of type "{actualType}". |
145
145
| <aid='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. |
146
-
| <aid='BCP139' />BCP139 |Warning| A resource's scope must match the scope of the Bicep file for it to be deployable. You must use modules to deploy resources to a different scope. |
146
+
| <aid='BCP083' />[BCP139](./diagnostics/bcp139.md)|Error| A resource's scope must match the scope of the Bicep file for it to be deployable. You must use modules to deploy resources to a different scope. |
147
147
| <aid='BCP140' />BCP140 | Error | The multi-line string at this location isn't terminated. Terminate it with "'''. |
148
148
| <aid='BCP141' />BCP141 | Error | The expression can't be used as a decorator as it isn't callable. |
149
149
| <aid='BCP142' />BCP142 | Error | Property value for-expressions can't be nested. |
@@ -171,7 +171,7 @@ If you need more information about a particular diagnostic code, select the **Fe
171
171
| <aid='BCP167' />BCP167 | Error | Expected the "{" character or the "if" keyword at this location. |
172
172
| <aid='BCP168' />BCP168 | Error | Length must not be a negative value. |
173
173
| <aid='BCP169' />BCP169 | Error | Expected resource name to contain {expectedSlashCount} "/" character(s). The number of name segments must match the number of segments in the resource type. |
174
-
| <aid='BCP170' />BCP170 | Error | Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully-qualified name. |
174
+
| <aid='BCP170' />BCP170 | Error | Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fullyqualified name. |
175
175
| <aid='BCP171' />BCP171 | Error | Resource type "{resourceType}" isn't a valid child resource of parent "{parentResourceType}". |
176
176
| <aid='BCP172' />BCP172 | Error | The resource type can't be validated due to an error in parent resource "{resourceName}". |
177
177
| <aid='BCP173' />BCP173 | Error | The property "{property}" can't be used in an existing resource declaration. |
@@ -258,7 +258,7 @@ If you need more information about a particular diagnostic code, select the **Fe
258
258
| <aid='BCP261' />BCP261 | Error | A using declaration must be present in this parameters file. |
259
259
| <aid='BCP262' />BCP262 | Error | More than one using declaration is present. |
260
260
| <aid='BCP263' />BCP263 | Error | The file specified in the using declaration path doesn't exist. |
261
-
| <aid='BCP264' />BCP264 | Error | Resource type "{resourceTypeName}" is declared in multiple imported namespaces ({ToQuotedStringWithCaseInsensitiveOrdering(namespaces)}), and must be fully-qualified. |
261
+
| <aid='BCP264' />BCP264 | Error | Resource type "{resourceTypeName}" is declared in multiple imported namespaces ({ToQuotedStringWithCaseInsensitiveOrdering(namespaces)}), and must be fullyqualified. |
262
262
| <aid='BCP265' />BCP265 | Error | The name "{name}" isn't a function. Did you mean "{knownFunctionNamespace}.{knownFunctionName}"? |
263
263
| <aid='BCP266' />BCP266 | Error | Expected a metadata identifier at this location. |
264
264
| <aid='BCP267' />BCP267 | Error | Expected a metadata declaration after the decorator. |
description: Error - A resource's scope must match the scope of the Bicep file for it to be deployable. You must use modules to deploy resources to a different scope.
4
+
ms.topic: reference
5
+
ms.custom: devx-track-bicep
6
+
ms.date: 09/20/2024
7
+
---
8
+
9
+
# Bicep error code - BCP139
10
+
11
+
This error occurs when you use [`resource`](../file.md#resources) to deploy resources to a different scope than the target one. You should use [`module`](../file.md#modules) instead. For more information, see the following articles based on the scope:
12
+
13
+
- Resource group: [Scope to different resource group](../deploy-to-resource-group.md#scope-to-different-resource-group).
`A resource's scope must match the scope of the Bicep file for it to be deployable. You must use modules to deploy resources to a different scope.`
21
+
22
+
## Solution
23
+
24
+
To deploy resources to a scope that isn't the target scope, add a `module`.
25
+
26
+
## Examples
27
+
28
+
The following example deploys a storage account resource to a different resource group in the same subscription. The example raises the error because the `module` declaration type isn't used:
29
+
30
+
```bicep
31
+
param otherResourceGroup string
32
+
param location string
33
+
34
+
// resource deployed to a different resource group in the same subscription
0 commit comments