Unable to add multiple addressPrefixes to VNET? #2153
-
param location string
param vNet array
resource vNet1 'Microsoft.Network/virtualNetworks@2020-06-01' = [for vnt in vNet: {
name: vnt.vnetname
location: location
properties: {
addressSpace: {
addressPrefixes: [
vnt.addressspace
#ADD MULTIPLE ADDRESS PREFIX#
]
}
subnets: [for subnet in vnt.subnetname: {
name: subnet.subnetname
properties: {
addressPrefix: subnet.subnetaddressspace
}
}]
}
}] ################################################### var vnet=[
{
vnetname:concat(nameprefix,'-Vnet')
addressspace:[
'10.172.11.0/24'
'10.172.12.0/24'
]
subnetname:[
{
subnetname:concat(nameprefix,'-snet')
subnetaddressspace:'10.172.11.0/24'
}
{
subnetname:concat(nameprefix,'-snet')
subnetaddressspace: '10.172.12.0/24'
}
]
}
module vnets 'Virtualnetwork/Virtualnetwork.bicep' ={
name:'vnetcreator'
params:{
vNet:vnet
location:location
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
alex-frankel
Apr 6, 2021
Replies: 1 comment
-
Does this work? I think you are currently technically passing the resource vNet1 'Microsoft.Network/virtualNetworks@2020-06-01' = [for vnt in vNet: {
...
properties: {
addressSpace: {
addressPrefixes: vnt.addressspace // address space is an array, so can be provided directly, not inside another array
}
...
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
niskemp
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this work? I think you are currently technically passing the
vnet.properties.addressSpaces
property an array of arrays, not a single array.