Bicep error/warning code - BCP035

This error/warning occurs when your resource definition is missing a required property.

Error/warning description

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

Solution

Add the missing property to the resource definition.

Examples

The following example raises the warning 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 warning 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 = 'eastus'
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' 
  }
}

Next steps

For more information about Bicep error and warning codes, see Bicep warnings and errors.