Skip to content

Commit fde7785

Browse files
committed
Add BCP420
1 parent 2eeb134 commit fde7785

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ If you need more information about a particular diagnostic code, select the **Fe
399399
| <a id='BCP417' />BCP417 | Error | The spread operator `{ellipsis}` cannot be used inside objects with property for-expressions. |
400400
| <a id='BCP418' />BCP418 | Error | Extensions cannot be referenced here. Extensions can only be referenced by module extension configurations. |
401401
| <a id='BCP419' />BCP419 | Error | Namespace name `{name}` cannot be used as an extension name.|
402-
| <a id='BCP420' />BCP420 | Error | The scope could not be resolved at compile time because the supplied expression is ambiguous or too complex. Scoping expressions must be reducible to a specific kind of scope without knowledge of parameter values. |
402+
| <a id='BCP420' />[BCP420](./diagnostics/bcp420.md) | Error | The scope could not be resolved at compile time because the supplied expression is ambiguous or too complex. Scoping expressions must be reducible to a specific kind of scope without knowledge of parameter values. |
403403
| <a id='BCP421' />BCP421 | Error | Module `{moduleName}` contains one or more secure outputs, which are not supported with `{LanguageConstants.TargetScopeKeyword}` set to `{LanguageConstants.TargetScopeTypeLocal}`.|
404404
| <a id='BCP422' />BCP422 | Error | A resource of type `{baseType}` may or may not exist when this function is called, which could cause the deployment to fail.|
405405

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: BCP420
3+
description: The scope couldn't be resolved at compile time because the supplied expression is ambiguous or too complex. Scoping expressions must be reducible to a specific kind of scope without knowledge of parameter values.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 06/25/2025
7+
---
8+
9+
# Bicep diagnostic code - BCP420
10+
11+
In Bicep, every resource or module must have a known deployment scope at compile time. The scope must be statically determinable. If the scope depends on a parameter, a variable, or an expression that can't be evaluated during compilation, Bicep throws BCP420.
12+
13+
## Description
14+
15+
The scope couldn't be resolved at compile time because the supplied expression is ambiguous or too complex. Scoping expressions must be reducible to a specific kind of scope without knowledge of parameter values.
16+
17+
## Level
18+
19+
Error
20+
21+
## Examples
22+
23+
The following code triggers BCP420 because the scope can't be determined at the compile time.
24+
25+
```bicep
26+
param targetResourceGroupName string = 'my-target-rg'
27+
param storageAccountName string = 'mystorageacct'
28+
param location string = 'eastus'
29+
30+
module storageModule './module.bicep' = {
31+
name: 'deployStorage'
32+
scope: empty(targetResourceGroupName) ? resourceGroup() : resourceGroup(targetResourceGroupName)
33+
params: {
34+
storageAccountName: storageAccountName
35+
location: location
36+
}
37+
}
38+
```
39+
40+
## Next steps
41+
42+
For more information about Bicep diagnostics, see [Bicep core diagnostics](../bicep-core-diagnostics.md).

0 commit comments

Comments
 (0)