In my bicep file I obtain a reference to the existing vnet like this:
resource existingVNET 'Microsoft.Network/virtualNetworks@2021-02-01' existing = {
name: 'the-existing-vnet'
}
I have tried to include multiple (four to be exact) resource statements for each of the subnets like this:
resource subnetPbdResource 'Microsoft.Network/virtualNetworks/subnets@2020-11-01' = {
parent: existingVNET
name: 'first-snet'
...
}
resource subnetPbdResource 'Microsoft.Network/virtualNetworks/subnets@2020-11-01' = {
parent: existingVNET
name: 'second-snet'
...
}
...however, when I run this (using az deployment group create ...) I get an error: with code AnotherOperationInProgress. One random (it seems) subnet has been created under the vnet.
I've also tried to define an array of subnets like this:
var subnets = [
{
name: 'api'
subnetPrefix: '10.144.0.0/24'
}
{
name: 'worker'
subnetPrefix: '10.144.1.0/24'
}
]
...but I cannot find a way to assign the existing vnet with the subnets array. .properties.subnets is not accessible for the existing vnet resource it seems.
Any tip appreciated!