Skip to content

Commit afc4f65

Browse files
author
Jill Grant
authored
Merge pull request #283841 from mumian/0806-error-codes-bcp052
Document BCP052, 077, 078, 083, 088, 089
2 parents 3d5023a + 108d192 commit afc4f65

File tree

11 files changed

+300
-34
lines changed

11 files changed

+300
-34
lines changed

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

Lines changed: 30 additions & 30 deletions
Large diffs are not rendered by default.

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Add the missing property to the resource definition.
2020

2121
## Examples
2222

23-
The following example raises the warning for **virtualNetworkGateway1** and **virtualNetworkGateway2**:
23+
The following example raises the warning for _virtualNetworkGateway1_ and _virtualNetworkGateway2_:
2424

2525
```bicep
2626
var networkConnectionName = 'testConnection'
@@ -78,6 +78,24 @@ resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
7878
}
7979
```
8080

81+
The following example raises the error for _outValue_ because the required property _value_ is missing:
82+
83+
```bicep
84+
@discriminator('type')
85+
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
86+
87+
output outValue taggedUnion = {type: 'foo'}
88+
```
89+
90+
You can fix the issue by adding the missing properties:
91+
92+
```bicep
93+
@discriminator('type')
94+
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
95+
96+
output outValue taggedUnion = {type: 'foo', value: 3}
97+
```
98+
8199
## Next steps
82100

83101
For more information about Bicep error and warning codes, see [Bicep core diagnostics](../bicep-core-diagnostics.md).
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: BCP052
3+
description: Error/warning - The type <type-name> does not contain property <property-name>.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP052
10+
11+
This error/warning occurs when you reference a property that isn't defined in the [data type](../data-types.md) or the [user-defined data type](../user-defined-data-types.md).
12+
13+
## Error/warning description
14+
15+
`The type <type-name> does not contain property <property-name>.`
16+
17+
## Examples
18+
19+
The following example raises the error _object_ doesn't contain a property called _bar_:
20+
21+
```bicep
22+
type foo = object.bar
23+
```
24+
25+
You can fix the error by removing the property:
26+
27+
```bicep
28+
type foo = object
29+
```
30+
31+
## Next steps
32+
33+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: BCP053
3-
description: Error/warning - The type <resource-type> does not contain property <property-name>. Available properties include <property-names>.
3+
description: Error/warning - The type <type-name> does not contain property <property-name>. Available properties include <property-names>.
44
ms.topic: reference
55
ms.custom: devx-track-bicep
66
ms.date: 07/15/2024
@@ -12,7 +12,7 @@ This error/warning occurs when you reference a property that isn't defined in th
1212

1313
## Error/warning description
1414

15-
`The type <resource-type> does not contain property <property-name>. Available properties include <property-names>.`
15+
`The type <type-name> does not contain property <property-name>. Available properties include <property-names>.`
1616

1717
## Solution
1818

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: BCP077
3+
description: Error/warning - The property <property-name> on type <type-name> is write-only. Write-only properties cannot be accessed.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP077
10+
11+
This error/warning occurs when you reference a property that is write-only.
12+
13+
## Error/warning description
14+
15+
`The property <property-name> on type <type-name> is write-only. Write-only properties cannot be accessed.`
16+
17+
## Examples
18+
19+
The following example raises the warning because `customHeaders` is a write-only property.
20+
21+
```bicep
22+
resource webhook 'Microsoft.ContainerRegistry/registries/webhooks@2023-07-01' existing = {
23+
name: 'registry/webhook'
24+
}
25+
26+
output customerHeaders object = webhook.properties.customHeaders
27+
```
28+
29+
## Next steps
30+
31+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: BCP078
3+
description: Error/warning - The property <property-name> requires a value of type <type-name>, but none was supplied.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP078
10+
11+
This error/warning occurs when you reference a [custom-tagged union data type](../data-types.md#custom-tagged-union-data-type), but the required value isn't provided.
12+
13+
## Error/warning description
14+
15+
`The property <property-name> requires a value of type <type-name>, but none was supplied.`
16+
17+
## Examples
18+
19+
The following example raises the error because the property _type_ with the value of _`foo`_ or `_bar_` isn't provided.
20+
21+
```bicep
22+
@discriminator('type')
23+
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
24+
25+
output outValue taggedUnion = {}
26+
```
27+
28+
You can fix the error by including the properties:
29+
30+
```bicep
31+
@discriminator('type')
32+
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
33+
34+
output outValue taggedUnion = {type: 'foo', value: 3}
35+
```
36+
37+
If the property _value_ isn't provided in the preceding example, you get [BCP035](./bcp035.md).
38+
39+
## Next steps
40+
41+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: BCP083
3+
description: Error/warning - The type <type-definition> does not contain property <property-name>. Did you mean <property-name>?
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP083
10+
11+
This error/warning occurs when you reference a property of a type that appears to be a typo.
12+
13+
## Error/warning description
14+
15+
`The type <type-definition> does not contain property <property-name>. Did you mean <property-name>?`
16+
17+
## Examples
18+
19+
The following example raises the error because _foo.type1_ looks like a typo.
20+
21+
```bicep
22+
type foo = {
23+
type: string
24+
}
25+
26+
type bar = foo.type1
27+
```
28+
29+
You can fix the error by correcting the typo:
30+
31+
```bicep
32+
type foo = {
33+
type: string
34+
}
35+
36+
type bar = foo.type
37+
```
38+
39+
## Next steps
40+
41+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: BCP088
3+
description: Error/warning - The property <property-name> expected a value of type <type-name> but the provided value is of type <type-name>. Did you mean <type-name>?
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP088
10+
11+
This error/warning occurs when a value of a property seems to be a typo.
12+
13+
## Error/warning description
14+
15+
`The property <property-name> expected a value of type <type-name> but the provided value is of type <type-name>. Did you mean <type-name>?`
16+
17+
## Examples
18+
19+
The following example raises the error because _name_ value _ad_ looks like a typo.
20+
21+
```bicep
22+
resource kv 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
23+
name: 'vault'
24+
25+
resource ap 'accessPolicies' = {
26+
name: 'ad'
27+
properties: {
28+
accessPolicies: []
29+
}
30+
}
31+
}
32+
```
33+
34+
You can fix the error by correcting the typo:
35+
36+
```bicep
37+
resource kv 'Microsoft.KeyVault/vaults@2023-07-01' existing = {
38+
name: 'vault'
39+
40+
resource ap 'accessPolicies' = {
41+
name: 'add'
42+
properties: {
43+
accessPolicies: []
44+
}
45+
}
46+
}
47+
```
48+
49+
## Next steps
50+
51+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: BCP089
3+
description: Error/warning - The property <property-name> isn't allowed on objects of type <resource-type>. Did you mean <property-name>?
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 08/06/2024
7+
---
8+
9+
# Bicep error/warning code - BCP089
10+
11+
This error/warning occurs when a property name seems to be a typo.
12+
13+
## Error/warning description
14+
15+
`The property <property-name> is not allowed on objects of type <resource-type>. Did you mean <property-name>?`
16+
17+
## Examples
18+
19+
The following example raises the error because the property name _named_ looks like a typo.
20+
21+
```bicep
22+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' existing = {
23+
named: 'account'
24+
}
25+
```
26+
27+
You can fix the error by correcting the typo:
28+
29+
```bicep
30+
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' existing = {
31+
name: 'account'
32+
}
33+
```
34+
35+
## Next steps
36+
37+
For more information about Bicep error and warning codes, see [Bicep warnings and errors](../bicep-core-diagnostics.md).

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,10 +617,24 @@
617617
href: diagnostics/bcp037.md
618618
- name: BCP040
619619
href: diagnostics/bcp040.md
620+
- name: BCP052
621+
href: diagnostics/bcp052.md
622+
- name: BCP053
623+
href: diagnostics/bcp053.md
620624
- name: BCP072
621625
href: diagnostics/bcp072.md
622626
- name: BCP073
623627
href: diagnostics/bcp073.md
628+
- name: BCP077
629+
href: diagnostics/bcp077.md
630+
- name: BCP078
631+
href: diagnostics/bcp078.md
632+
- name: BCP083
633+
href: diagnostics/bcp083.md
634+
- name: BCP088
635+
href: diagnostics/bcp088.md
636+
- name: BCP089
637+
href: diagnostics/bcp089.md
624638
- name: BCP327
625639
href: diagnostics/bcp327.md
626640
- name: BCP328

0 commit comments

Comments
 (0)