Skip to content

Commit 525759c

Browse files
committed
Add bcp036, bcp037, bcp073
1 parent d353635 commit 525759c

File tree

8 files changed

+193
-14
lines changed

8 files changed

+193
-14
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
title: BCP033
3-
description: Error - Expected a value of type "{expectedType}" but the provided value is of type "{actualType}".
3+
description: Error - Expected a value of type <data-type> but the provided value is of type <data-type>.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
66
ms.date: 06/28/2024
77
---
88

9-
# Bicep warning and error code - BCP033
9+
# Bicep error code - BCP033
1010

1111
This error occurs when you assign a value of a mismatched data type.
1212

1313
## Error description
1414

15-
`Expected a value of type "{expectedType}" but the provided value is of type "{actualType}".`
15+
`Expected a value of type <data-type> but the provided value is of type <data-type>.`
1616

1717
## Solution
1818

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
---
22
title: BCP035
3-
description: Error - The specified <data-type> declaration is missing the following required properties.
3+
description: Warning - The specified <data-type> declaration is missing the following required properties <property-name>.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
66
ms.date: 06/28/2024
77
---
88

9-
# Bicep warning and error code - BCP035
9+
# Bicep warning code - BCP035
1010

1111
This warning occurs when your resource definition is missing a required property.
1212

1313
## Warning description
1414

15-
`The specified <date-type> declaration is missing the following required properties: <name-of-the-property.`
15+
`The specified <date-type> declaration is missing the following required properties: <property-name>.`
1616

1717
## Solution
1818

@@ -52,7 +52,7 @@ The specified "object" declaration is missing the following required properties:
5252

5353
You can verify the missing properties from the [template reference](/azure/templates). If you see the warning from Visual Studio Code, hover the cursor over the resource symbolic name and select **View document** to open the template reference.
5454

55-
You can fix the error by adding the missing properties:
55+
You can fix the issue by adding the missing properties:
5656

5757
```bicep
5858
var networkConnectionName = 'testConnection'
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
title: BCP036
3+
description: Error - The property <property-name> expected a value of type <data-type> but the provided value is of type <data-type>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep error code - BCP036
10+
11+
This error occurs when you assign a value to a property using a data type that differs from the one defined in the [user-defined data type](./user-defined-data-types.md).
12+
13+
## Error description
14+
15+
`The property <property-name> expected a value of type <data-type> but the provided value is of type <data-type>.`
16+
17+
## Solution
18+
19+
Assign a value with the correct data type.
20+
21+
## Examples
22+
23+
The following example raises the error because `sku` is defined as a string, not an integer:
24+
25+
```bicep
26+
type storageAccountConfigType = {
27+
name: string
28+
sku: string
29+
}
30+
31+
param foo storageAccountConfigType = {
32+
name: 'myStorage'
33+
sku: 2
34+
}
35+
```
36+
37+
You can fix the issue by assigning a string value to `sku`:
38+
39+
```bicep
40+
type storageAccountConfigType = {
41+
name: string
42+
sku: string
43+
}
44+
45+
param foo storageAccountConfigType = {
46+
name: 'myStorage'
47+
sku: 'Standard_LRS'
48+
}
49+
```
50+
51+
## Next steps
52+
53+
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: BCP037
3+
description: Warning - The property <property-name> is not allowed 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 - BCP037
10+
11+
This warning occurs when you specify a property that is not defined in a [user-defined data type](./user-defined-data-types.md).
12+
13+
## Warning description
14+
15+
`The property <property-name> is not allowed on objects of type <type-defintion>.`
16+
17+
## Solution
18+
19+
Remove the undefined property.
20+
21+
## Examples
22+
23+
The following example raises the warning because `bar` is not defined in `storageAccountType`:
24+
25+
```bicep
26+
type storageAccountConfigType = {
27+
name: string
28+
sku: string
29+
}
30+
31+
param foo storageAccountConfigType = {
32+
name: 'myStorage'
33+
sku: 'Standard_LRS'
34+
bar: 'myBar'
35+
}
36+
```
37+
38+
You can fix the issue by removing the property:
39+
40+
```bicep
41+
type storageAccountConfigType = {
42+
name: string
43+
sku: string
44+
}
45+
46+
param foo storageAccountConfigType = {
47+
name: 'myStorage'
48+
sku: 'Standard_LRS'
49+
}
50+
```
51+
52+
## Next steps
53+
54+
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-bcp072.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.custom: devx-track-bicep
66
ms.date: 07/02/2024
77
---
88

9-
# Bicep warning and error code - BCP072
9+
# Bicep error code - BCP072
1010

1111
This error occurs when you reference a variable in parameter default values.
1212

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: BCP073
3+
description: Warning - The property <property-name> is read-only. Expressions cannot be assigned to read-only properties.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 07/12/2024
7+
---
8+
9+
# Bicep warning code - BCP073
10+
11+
This warning occurs when you assign a value to a read-only property
12+
13+
## Warning description
14+
15+
`The property <property-name> is read-only. Expressions cannot be assigned to read-only properties.`
16+
17+
## Solution
18+
19+
Remove the property assignment from the file.
20+
21+
## Examples
22+
23+
The following example raises the warning because `sku` can only be set on the `storageAccounts` level. It is read-only for services that are under a storage account like `blobServices` and `fileServices`.
24+
25+
```bicep
26+
param location string
27+
28+
resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
29+
name: 'mystore'
30+
location: location
31+
sku: {
32+
name: 'Standard_LRS'
33+
}
34+
kind: 'StorageV2'
35+
}
36+
37+
resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2023-04-01' = {
38+
parent: storage
39+
name: 'default'
40+
sku: {}
41+
}
42+
```
43+
44+
You can fix the issue by removing the `sku` property assingment:
45+
46+
```bicep
47+
param location string
48+
49+
resource storage 'Microsoft.Storage/storageAccounts@2023-04-01' = {
50+
name: 'mystore'
51+
location: location
52+
sku: {
53+
name: 'Standard_LRS'
54+
}
55+
kind: 'StorageV2'
56+
}
57+
58+
resource blobService 'Microsoft.Storage/storageAccounts/blobServices@2023-04-01' = {
59+
parent: storage
60+
name: 'default'
61+
}
62+
```
63+
64+
## Next steps
65+
66+
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: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Bicep warnings and error codes
33
description: Lists the warnings and error codes.
44
ms.topic: conceptual
55
ms.custom: devx-track-azurecli, devx-track-bicep, devx-track-arm-template
6-
ms.date: 06/28/2024
6+
ms.date: 07/12/2024
77
---
88

99
# Bicep warning and error codes
@@ -42,11 +42,11 @@ If you need more information about a particular warning or error code, select th
4242
| BCP030 | The output type is not valid. Please specify one of the following types: {ToQuotedString(validTypes)}. |
4343
| BCP031 | The parameter type is not valid. Please specify one of the following types: {ToQuotedString(validTypes)}. |
4444
| BCP032 | The value must be a compile-time constant. |
45-
| [BCP033](./bicep-error-bcp033.md) | Expected a value of type "{expectedType}" but the provided value is of type "{actualType}". |
45+
| [BCP033](./bicep-error-bcp033.md) | Expected a value of type &lt;data-type> but the provided value is of type &lt;data-type>. |
4646
| BCP034 | The enclosing array expected an item of type "{expectedType}", but the provided item was of type "{actualType}". |
47-
| [BCP035](./bicep-error-bcp035.md) | The specified "{blockName}" declaration is missing the following required properties{sourceDeclarationClause}: {ToQuotedString(properties)}.{(showTypeInaccuracy ? TypeInaccuracyClause : string.Empty)} |
48-
| BCP036 | The property "{property}" expected a value of type "{expectedType}" but the provided value{sourceDeclarationClause} is of type "{actualType}".{(showTypeInaccuracy ? TypeInaccuracyClause : string.Empty)} |
49-
| BCP037 | The property "{property}"{sourceDeclarationClause} is not allowed on objects of type "{type}".{permissiblePropertiesClause}{(showTypeInaccuracy ? TypeInaccuracyClause : string.Empty)} |
47+
| [BCP035](./bicep-error-bcp035.md) | The specified &lt;data-type> declaration is missing the following required properties: &lt;property-name>. |
48+
| [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>. |
49+
| [BCP037](./bicep-error-bcp037.md) | The property &lt;property-name> is not allowed on objects of type &lt;type-definition>. |
5050
| BCP040 | String interpolation is not supported for keys on objects of type "{type}"{sourceDeclarationClause}.{permissiblePropertiesClause} |
5151
| BCP041 | Values of type "{valueType}" cannot be assigned to a variable. |
5252
| BCP043 | This is not a valid expression. |
@@ -78,7 +78,7 @@ If you need more information about a particular warning or error code, select th
7878
| BCP070 | Argument of type "{argumentType}" is not assignable to parameter of type "{parameterType}". |
7979
| BCP071 | Expected {expected}, but got {argumentCount}. |
8080
| [BCP072](./bicep-error-bcp072.md) | This symbol cannot be referenced here. Only other parameters can be referenced in parameter default values. |
81-
| BCP073 | The property "{property}" is read-only. Expressions cannot be assigned to read-only properties.{(showTypeInaccuracy ? TypeInaccuracyClause : string.Empty)} |
81+
| [BCP073](./bicep-error-bcp073.md) | The property &lt;property-name> is read-only. Expressions cannot be assigned to read-only properties. |
8282
| BCP074 | Indexing over arrays requires an index of type "{LanguageConstants.Int}" but the provided index was of type "{wrongType}". |
8383
| BCP075 | Indexing over objects requires an index of type "{LanguageConstants.String}" but the provided index was of type "{wrongType}". |
8484
| BCP076 | Cannot index over expression of type "{wrongType}". Arrays or objects are required. |

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,13 @@
607607
href: bicep-error-bcp033.md
608608
- name: BCP035
609609
href: bicep-error-bcp035.md
610+
- name: BCP036
611+
href: bicep-error-bcp036.md
612+
- name: BCP037
613+
href: bicep-error-bcp037.md
610614
- name: BCP072
611615
href: bicep-error-bcp072.md
616+
- name: BCP073
617+
href: bicep-error-bcp073.md
612618
- name: Azure CLI
613619
href: /cli/azure/resource

0 commit comments

Comments
 (0)