Επεξεργασία

Κοινή χρήση μέσω


Bicep diagnostic code - BCP037

This diagnostic occurs when you specify a property that isn't defined in a resource type.

Description

The property <property-name> is not allowed on objects of type <type-defintion>.

Level

Warning / Error

Solution

Remove the undefined property.

Examples

The following example raises the diagnostic because bar isn't defined in storageAccountType:

type storageAccountConfigType = {
  name: string
  sku: string
}

param foo storageAccountConfigType = {
  name: 'myStorage'
  sku: 'Standard_LRS' 
  bar: 'myBar'
}

You can fix the issue by removing the property:

type storageAccountConfigType = {
  name: string
  sku: string
}

param foo storageAccountConfigType = {
  name: 'myStorage'
  sku: 'Standard_LRS' 
}

The following example raises the diagnostic because obj is a sealed type and doesn't define a baz property.

@sealed()
type obj = {
  foo: string
  bar: string
}

param p obj = {
  foo: 'foo'
  bar: 'bar'
  baz: 'baz' 
}

You can fix the issue by removing the property:

@sealed()
type obj = {
  foo: string
  bar: string
}

param p obj = {
  foo: 'foo'
  bar: 'bar'
}

Next steps

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