แก้ไข

แชร์ผ่าน


Bicep diagnostic code - BCP170

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.

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. For more information, see Child resources.

Level

Error

Solutions

Don't use a fully qualified name with "/" characters.

Examples

The following example raises the diagnostic because a fully qualified name is used for the child resource.

resource demoStore0220 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'demoStore0220'
  location: 'centralus'
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2' 
}

resource demoFileService0220 'Microsoft.Storage/storageAccounts/fileServices@2023-05-01' = {
  parent: demoStore0220
  name: 'demoStore0220/default'
}

You can fix the diagnostic by updating the child resource name.

resource demoStore0220 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'demoStore0220'
  location: 'centralus'
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2' 
}

resource demoFileService0220 'Microsoft.Storage/storageAccounts/fileServices@2023-05-01' = {
  parent: demoStore0220
  name: 'default'
}

For more information, see Decorators.

Next steps

For more information about Bicep diagnostics, see Bicep core diagnostics.