Bicep diagnostic code - BCP035

This diagnostic occurs when your resource definition is missing a required property.

Description

The specified <date-type> declaration is missing the following required properties: <property-name>.

Level

Warning / Error

Solution

Add the missing property to the resource definition.

Examples

The following example raises the diagnostic for virtualNetworkGateway1 and virtualNetworkGateway2:

var networkConnectionName = 'testConnection'
var location = 'eastus'
var vnetGwAId = 'gatewayA'
var vnetGwBId = 'gatewayB'

resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
  name: networkConnectionName
  location: location
  properties: {
    virtualNetworkGateway1: {
      id: vnetGwAId
    }
    virtualNetworkGateway2: {
      id: vnetGwBId
    }

    connectionType: 'Vnet2Vnet' 
  }
}

The diagnostic is:

The specified "object" declaration is missing the following required properties: "properties". If this is an inaccuracy in the documentation, please report it to the Bicep Team.

You can verify the missing properties from the template reference. 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.

You can fix the issue by adding the missing properties:

var networkConnectionName = 'testConnection'
var location = 'chinanorth3'
var vnetGwAId = 'gatewayA'
var vnetGwBId = 'gatewayB'

resource networkConnection 'Microsoft.Network/connections@2023-11-01' = {
  name: networkConnectionName
  location: location
  properties: {
    virtualNetworkGateway1: {
      id: vnetGwAId
      properties:{}
    }
    virtualNetworkGateway2: {
      id: vnetGwBId
      properties:{}
    }

    connectionType: 'Vnet2Vnet' 
  }
}

The following example raises the diagnostic for outValue because the required property value is missing:

@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}

output outValue taggedUnion = {type: 'foo'}

You can fix the issue by adding the missing properties:

@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}

output outValue taggedUnion = {type: 'foo', value: 3}

Next steps

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