Skip to content

Commit ffd4290

Browse files
committed
document bcp040, bcp053, bcp327, bcp328, bcp332, and bcp333
1 parent 525759c commit ffd4290

File tree

8 files changed

+298
-5
lines changed

8 files changed

+298
-5
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: BCP040
3+
description: Warning - String interpolation is not supported for keys on objects of type <type-definition>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep warning code - BCP040
10+
11+
This warning occurs when you use string interpolation to specify a key of a [user-defined data type](./user-defined-data-types.md).
12+
13+
## Warning description
14+
15+
`String interpolation is not supported for keys on objects of type <type-definition>.`
16+
17+
## Solution
18+
19+
Remove string interpolation.
20+
21+
## Examples
22+
23+
The following example raises the warning because string interpolation is used for specifying the key `sku1`:
24+
25+
```bicep
26+
var name = 'sku'
27+
28+
type storageAccountConfigType = {
29+
name: string
30+
sku1: string
31+
}
32+
33+
param foo storageAccountConfigType = {
34+
name: 'myStorage'
35+
'${name}1': 'Standard_LRS'
36+
}
37+
```
38+
39+
You can fix the issue by adding the missing properties:
40+
41+
```bicep
42+
var name = 'sku'
43+
44+
type storageAccountConfigType = {
45+
name: string
46+
sku1: string
47+
}
48+
49+
param foo storageAccountConfigType = {
50+
name: 'myStorage'
51+
sku1: 'Standard_LRS'
52+
}
53+
```
54+
55+
## Next steps
56+
57+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: BCP053
3+
description: Error - The type <resource-type> does not contain property <property-name>. Available properties include <property-names>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep error code - BCP053
10+
11+
This error occurs when you reference a property that is not defined in the resource type.
12+
13+
## Error description
14+
15+
`The type <resource-type> does not contain property <property-name>. Available properties include <property-names>.`
16+
17+
## Solution
18+
19+
Reference the correct property name
20+
21+
## Examples
22+
23+
The following example raises the error because `Microsoft.Storage/storageAccounts` doesn't contain a property called `bar`.
24+
25+
```bicep
26+
param location string
27+
28+
resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
29+
name: 'myStorage'
30+
location: location
31+
sku: {
32+
name: 'Standard_LRS'
33+
}
34+
kind: 'StorageV2'
35+
}
36+
37+
output foo string = storage.bar
38+
```
39+
40+
You can fix the error by referencing a valid property, such as `name`:
41+
42+
```bicep
43+
param location string
44+
45+
resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
46+
name: 'myStorage'
47+
location: location
48+
sku: {
49+
name: 'Standard_LRS'
50+
}
51+
kind: 'StorageV2'
52+
}
53+
54+
output foo string = storage.name
55+
```
56+
57+
## Next steps
58+
59+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
title: BCP327
3+
description: Error - The provided value (which will always be greater than or equal to <value>) is too large to assign to a target for which the maximum allowable value is <max-value>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/02/2024
7+
---
8+
9+
# Bicep error code - BCP327
10+
11+
This error occurs when you assign a value that is greater than the allowable value.
12+
13+
## Error description
14+
15+
`The provided value (which will always be greater than or equal to <value>) is too large to assign to a target for which the maximum allowable value is <max-value>.`
16+
17+
## Solution
18+
19+
Assign a value that falls within the permitted range.
20+
21+
## Examples
22+
23+
The following example raises the error because `13` is greater than maximum allowable value:
24+
25+
```bicep
26+
@minValue(1)
27+
@maxValue(12)
28+
param month int = 13
29+
30+
```
31+
32+
You can fix the error by assigning a value within the permitted range:
33+
34+
```bicep
35+
@minValue(1)
36+
@maxValue(12)
37+
param month int = 12
38+
39+
```
40+
41+
## Next steps
42+
43+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: BCP328
3+
description: Error - The provided value (which will always be less than or equal to <value>) is too small to assign to a target for which the minimum allowable value is <min-value>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep error code - BCP328
10+
11+
This error occurs when you assign a value that is less than the allowable value.
12+
13+
## Error description
14+
15+
`The provided value (which will always be less than or equal to <value>) is too small to assign to a target for which the minimum allowable value is <min-value>.`
16+
17+
## Solution
18+
19+
Assign a value that falls within the permitted range.
20+
21+
## Examples
22+
23+
The following example raises the error because `0` is less than minimum allowable value:
24+
25+
```bicep
26+
@minValue(1)
27+
@maxValue(12)
28+
param month int = 0
29+
30+
```
31+
32+
You can fix the error by assigning a value within the permitted range:
33+
34+
```bicep
35+
@minValue(1)
36+
@maxValue(12)
37+
param month int = 1
38+
```
39+
40+
## Next steps
41+
42+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: BCP332
3+
description: Error - The provided value (whose length will always be greater than or equal to <value-length>) is too long to assign to a target for which the maximum allowable length is <max-length>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep error code - BCP332
10+
11+
This error occurs when a string exceeding the allowable length is assigned.
12+
13+
## Error description
14+
15+
`The provided value (whose length will always be greater than or equal to <value-length>) is too long to assign to a target for which the maximum allowable length is <max-length>.`
16+
17+
## Solution
18+
19+
Assign a string whose length is within the allowable range.
20+
21+
## Examples
22+
23+
The following example raises the error because the value `longerThan10` exceeds the allowable length:
24+
25+
```bicep
26+
@minLength(3)
27+
@maxLength(10)
28+
param storageAccountName string = 'longerThan10'
29+
```
30+
31+
You can fix the error by assigning a string whose length is within the allowable range.
32+
33+
```bicep
34+
@minLength(3)
35+
@maxLength(10)
36+
param storageAccountName string = 'myStorage'
37+
```
38+
39+
## Next steps
40+
41+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: BCP332
3+
description: Error - The provided value (whose length will always be less than or equal to <value-length>) is too short to assign to a target for which the minimum allowable length is <min-length>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep error code - BCP332
10+
11+
This error occurs when a string assigned is shorter than the allowable length.
12+
13+
## Error description
14+
15+
`The provided value (whose length will always be less than or equal to <value-length>) is too short to assign to a target for which the minimum allowable length is <min-length>.`
16+
17+
## Solution
18+
19+
Assign a string whose length is within the allowable range.
20+
21+
## Examples
22+
23+
The following example raises the error because the value `st` is shorter than the allowable length:
24+
25+
```bicep
26+
@minLength(3)
27+
@maxLength(10)
28+
param storageAccountName string = 'st'
29+
```
30+
31+
You can fix the error by assigning a string whose length is within the allowable range.
32+
33+
```bicep
34+
@minLength(3)
35+
@maxLength(10)
36+
param storageAccountName string = 'myStorage'
37+
```
38+
39+
## Next steps
40+
41+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).

articles/azure-resource-manager/bicep/bicep-error-codes.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If you need more information about a particular warning or error code, select th
4747
| [BCP035](./bicep-error-bcp035.md) | The specified &lt;data-type> declaration is missing the following required properties: &lt;property-name>. |
4848
| [BCP036](./bicep-error-bcp036.md) | The property &lt;property-name> expected a value of type &lt;data-type> but the provided value is of type &lt;data-type>. |
4949
| [BCP037](./bicep-error-bcp037.md) | The property &lt;property-name> is not allowed on objects of type &lt;type-definition>. |
50-
| BCP040 | String interpolation is not supported for keys on objects of type "{type}"{sourceDeclarationClause}.{permissiblePropertiesClause} |
50+
| [BCP040](./bicep-error-bcp040.md) | String interpolation is not supported for keys on objects of type &lt;type-definition>. |
5151
| BCP041 | Values of type "{valueType}" cannot be assigned to a variable. |
5252
| BCP043 | This is not a valid expression. |
5353
| BCP044 | Cannot apply operator "{operatorName}" to operand of type "{type}". |
@@ -251,13 +251,13 @@ If you need more information about a particular warning or error code, select th
251251
| BCP323 | The `[?]` (safe dereference) operator may not be used on resource or module collections. |
252252
| BCP325 | Expected a type identifier at this location. |
253253
| BCP326 | Nullable-typed parameters may not be assigned default values. They have an implicit default of 'null' that cannot be overridden. |
254-
| BCP327 | The provided value (which will always be greater than or equal to {sourceMin}) is too large to assign to a target for which the maximum allowable value is {targetMax}. |
255-
| BCP328 | The provided value (which will always be less than or equal to {sourceMax}) is too small to assign to a target for which the minimum allowable value is {targetMin}. |
254+
| [BCP327](./bicep-error-bcp327.md) | The provided value (which will always be greater than or equal to &lt;value>) is too large to assign to a target for which the maximum allowable value is &lt;max-value>. |
255+
| [BCP328](./bicep-error-bcp328.md) | The provided value (which will always be less than or equal to &lt;value>) is too small to assign to a target for which the minimum allowable value is &lt;max-value>. |
256256
| BCP329 | The provided value can be as small as {sourceMin} and may be too small to assign to a target with a configured minimum of {targetMin}. |
257257
| BCP330 | The provided value can be as large as {sourceMax} and may be too large to assign to a target with a configured maximum of {targetMax}. |
258258
| BCP331 | A type's "{minDecoratorName}" must be less than or equal to its "{maxDecoratorName}", but a minimum of {minValue} and a maximum of {maxValue} were specified. |
259-
| BCP332 | The provided value (whose length will always be greater than or equal to {sourceMinLength}) is too long to assign to a target for which the maximum allowable length is {targetMaxLength}. |
260-
| BCP333 | The provided value (whose length will always be less than or equal to {sourceMaxLength}) is too short to assign to a target for which the minimum allowable length is {targetMinLength}. |
259+
| [BCP332](./bicep-error-bcp332.md) | The provided value (whose length will always be greater than or equal to &lt;string-length>) is too long to assign to a target for which the maximum allowable length is &lt;max-length>. |
260+
| [BCP333](./bicep-error-bcp333.md) | The provided value (whose length will always be less than or equal to &lt;string-length>) is too short to assign to a target for which the minimum allowable length is &lt;min-length>. |
261261
| BCP334 | The provided value can have a length as small as {sourceMinLength} and may be too short to assign to a target with a configured minimum length of {targetMinLength}. |
262262
| BCP335 | The provided value can have a length as large as {sourceMaxLength} and may be too long to assign to a target with a configured maximum length of {targetMaxLength}. |
263263
| BCP337 | This declaration type is not valid for a Bicep Parameters file. Specify a "{LanguageConstants.UsingKeyword}", "{LanguageConstants.ParameterKeyword}" or "{LanguageConstants.VariableKeyword}" declaration. |

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,21 @@
609609
href: bicep-error-bcp035.md
610610
- name: BCP036
611611
href: bicep-error-bcp036.md
612+
- name: BCP040
613+
href: bicep-error-bcp040.md
612614
- name: BCP037
613615
href: bicep-error-bcp037.md
614616
- name: BCP072
615617
href: bicep-error-bcp072.md
616618
- name: BCP073
617619
href: bicep-error-bcp073.md
620+
- name: BCP327
621+
href: bicep-error-bcp327.md
622+
- name: BCP328
623+
href: bicep-error-bcp328.md
624+
- name: BCP332
625+
href: bicep-error-bcp332.md
626+
- name: BCP333
627+
href: bicep-error-bcp333.md
618628
- name: Azure CLI
619629
href: /cli/azure/resource

0 commit comments

Comments
 (0)