Skip to content

Commit 88d7bb0

Browse files
committed
Add BCP170
1 parent 8318dc1 commit 88d7bb0

File tree

2 files changed

+68
-1
lines changed

2 files changed

+68
-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
@@ -171,7 +171,7 @@ If you need more information about a particular diagnostic code, select the **Fe
171171
| <a id='BCP167' />BCP167 | Error | Expected the "{" character or the "if" keyword at this location. |
172172
| <a id='BCP168' />BCP168 | Error | Length must not be a negative value. |
173173
| <a id='BCP169' />BCP169 | Error | Expected resource name to contain {expectedSlashCount} "/" character(s). The number of name segments must match the number of segments in the resource type. |
174-
| <a id='BCP170' />BCP170 | Error | Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully qualified name. |
174+
| <a id='BCP170' />[BCP170](./diagnostics/bcp170.md) | Error | Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully qualified name. |
175175
| <a id='BCP171' />BCP171 | Error | Resource type "{resourceType}" isn't a valid child resource of parent "{parentResourceType}". |
176176
| <a id='BCP172' />BCP172 | Error | The resource type can't be validated due to an error in parent resource "{resourceName}". |
177177
| <a id='BCP173' />BCP173 | Error | The property "{property}" can't be used in an existing resource declaration. |
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
title: BCP170
3+
description: Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully qualified name.
4+
ms.topic: reference
5+
ms.custom: devx-track-bicep
6+
ms.date: 02/20/2025
7+
---
8+
9+
# Bicep diagnostic code - BCP170
10+
11+
This diagnostic occurs in a child resource definition when the parent property is specified, yet a fully qualified name is still used for the child resource.
12+
13+
## Description
14+
15+
Expected resource name to not contain any "/" characters. Child resources with a parent resource reference (via the parent property or via nesting) must not contain a fully qualified name. For more information, see [Child resources](../child-resource-name-type.md).
16+
17+
## Level
18+
19+
Error
20+
21+
## Solutions
22+
23+
Don't use a fully qualified name with "/" characters.
24+
25+
## Examples
26+
27+
The following example raises the diagnostic because a fully qualified name is used for the child resource.
28+
29+
```bicep
30+
resource demoStore0220 'Microsoft.Storage/storageAccounts@2023-05-01' = {
31+
name: 'demoStore0220'
32+
location: 'centralus'
33+
sku: {
34+
name: 'Standard_LRS'
35+
}
36+
kind: 'StorageV2'
37+
}
38+
39+
resource demoFileService0220 'Microsoft.Storage/storageAccounts/fileServices@2023-05-01' = {
40+
parent: demoStore0220
41+
name: 'demoStore0220/default'
42+
}
43+
```
44+
45+
You can fix the diagnostic by updating the child resource name.
46+
47+
```bicep
48+
resource demoStore0220 'Microsoft.Storage/storageAccounts@2023-05-01' = {
49+
name: 'demoStore0220'
50+
location: 'centralus'
51+
sku: {
52+
name: 'Standard_LRS'
53+
}
54+
kind: 'StorageV2'
55+
}
56+
57+
resource demoFileService0220 'Microsoft.Storage/storageAccounts/fileServices@2023-05-01' = {
58+
parent: demoStore0220
59+
name: 'default'
60+
}
61+
```
62+
63+
For more information, see [Decorators](../file.md#decorators).
64+
65+
## Next steps
66+
67+
For more information about Bicep diagnostics, see [Bicep core diagnostics](../bicep-core-diagnostics.md).

0 commit comments

Comments
 (0)