Skip to content

Commit 065500e

Browse files
authored
Merge pull request #280727 from mumian/0712-bcp073
Add bcp036, bcp037, bcp040, bcp053, bcp073, bcp327, bcp328, bcp332, bcp333
2 parents f074427 + 8eafdfd commit 065500e

14 files changed

+532
-29
lines changed

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

Lines changed: 7 additions & 7 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/warning - 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
6-
ms.date: 06/28/2024
6+
ms.date: 07/15/2024
77
---
88

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

11-
This error occurs when you assign a value of a mismatched data type.
11+
This error/warning occurs when you assign a value of a mismatched data type.
1212

13-
## Error description
13+
## Error/warning 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

@@ -38,4 +38,4 @@ output myString string = myValue
3838

3939
## Next steps
4040

41-
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
41+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).

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

Lines changed: 8 additions & 8 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: Error/warning - The specified <data-type> declaration is missing the following required properties <property-name>.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
6-
ms.date: 06/28/2024
6+
ms.date: 07/15/2024
77
---
88

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

11-
This warning occurs when your resource definition is missing a required property.
11+
This error/warning occurs when your resource definition is missing a required property.
1212

13-
## Warning description
13+
## Error/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'
@@ -80,4 +80,4 @@ resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
8080

8181
## Next steps
8282

83-
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
83+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).
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/warning - 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/15/2024
7+
---
8+
9+
# Bicep error/warning code - BCP036
10+
11+
This error/warning occurs when you assign a value to a property whose expected data type is not compatible with that of the assigned value.
12+
13+
## Error/warning 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 error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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/15/2024
7+
---
8+
9+
# Bicep warning code - BCP037
10+
11+
This warning occurs when you specify a property that isn't defined in a resource type.
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` isn't 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+
The following example raises the error because `obj` is a sealed type and doesn't define a `baz` property.
53+
54+
```bicep
55+
@sealed()
56+
type obj = {
57+
foo: string
58+
bar: string
59+
}
60+
61+
param p obj = {
62+
foo: 'foo'
63+
bar: 'bar'
64+
baz: 'baz'
65+
}
66+
```
67+
68+
You can fix the issue by removing the property:
69+
70+
```bicep
71+
@sealed()
72+
type obj = {
73+
foo: string
74+
bar: string
75+
}
76+
77+
param p obj = {
78+
foo: 'foo'
79+
bar: 'bar'
80+
}
81+
```
82+
83+
## Next steps
84+
85+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
title: BCP040
3+
description: Error/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/15/2024
7+
---
8+
9+
# Bicep error/warning code - BCP040
10+
11+
This error/warning occurs when the Bicep compiler cannot determine the exact value of an interpolated string key.
12+
13+
## Error/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 error and warning 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/warning - 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/15/2024
7+
---
8+
9+
# Bicep error/warning code - BCP053
10+
11+
This error/warning occurs when you reference a property that is not defined in the resource type or [user-defined data type](./user-defined-data-types.md).
12+
13+
## Error/warning 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 error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ title: BCP072
33
description: Error - This symbol cannot be referenced here. Only other parameters can be referenced in parameter default values.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
6-
ms.date: 07/02/2024
6+
ms.date: 07/15/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

@@ -39,4 +39,4 @@ output outValue string = foo
3939

4040
## Next steps
4141

42-
For more information about Bicep warning and error codes, see [Bicep warnings and errors](./bicep-error-codes.md).
42+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](./bicep-error-codes.md).

0 commit comments

Comments
 (0)