Codice di avviso/errore Bicep - BCP035
Questo errore o avviso si verifica quando la definizione della risorsa manca una proprietà obbligatoria.
Descrizione dell'errore/avviso
The specified <date-type> declaration is missing the following required properties: <property-name>.
Soluzione
Aggiungere la proprietà mancante alla definizione della risorsa.
Esempi
L'esempio seguente genera l'avviso per virtualNetworkGateway1 e 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'
}
}
L'avviso è:
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.
È possibile verificare le proprietà mancanti dal riferimento al modello. Se viene visualizzato l'avviso da Visual Studio Code, passare il cursore sul nome simbolico della risorsa e selezionare Visualizza documento per aprire il riferimento al modello.
È possibile risolvere il problema aggiungendo le proprietà mancanti:
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'
}
}
L'esempio seguente genera l'errore per outValue perché manca il valore della proprietà obbligatorio:
@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
output outValue taggedUnion = {type: 'foo'}
È possibile risolvere il problema aggiungendo le proprietà mancanti:
@discriminator('type')
type taggedUnion = {type: 'foo', value: int} | {type: 'bar', value: bool}
output outValue taggedUnion = {type: 'foo', value: 3}
Passaggi successivi
Per altre informazioni sui codici di errore e di avviso di Bicep, vedere Diagnostica dei core Bicep.