The linked property has values which are of invalid types 'Object'. #11296
-
Hi, I want to create a VNET and multiple subnets. I create network security groups per subnet and associate to the subnets. vnet.bicep module networkSecurityGroup 'modules/Microsoft.Network/networkSecurityGroups/deploy.bicep' = [for (sn, index) in vnet.subnets: {
name: '${uniqueString(deployment().name, location)}-nsg-${sn.name}'
scope: resourceGroup('network')
params: {
location: location
name: '${abbrs.networkNetworkSecurityGroups}${sn.name}'
}
}]
resource nsg 'Microsoft.Network/networkSecurityGroups@2021-02-01' existing = [for (sn, index) in vnet.subnets: {
name: '${abbrs.networkNetworkSecurityGroups}${sn.name}'
scope: resourceGroup('network')
}]
module virtualNetwork 'modules/Microsoft.Network/virtualNetworks/deploy.bicep' = {
name: '${uniqueString(deployment().name, location)}-virtualNetwork'
scope: resourceGroup('network')
params: {
location: rgNetwork.outputs.location
addressPrefixes: vnet.addressPrefixes
name: vnet.virtualNetworkName
subnets: [for (sn, index) in vnet.subnets: {
name: sn.name
addressPrefix: sn.subnetPrefix
networkSecurityGroupId: {
id: nsg[index].id
}
}
]
}
dependsOn: [
networkSecurityGroup
nsg
]
} vnet.bicepparam param vnet = {
virtualNetworkName: 'vnet1'
addressPrefixes: [
'20.0.0.0/24'
]
subnets: [
{
name: 'snet-frontend-001'
subnetPrefix: '20.0.0.0/26'
}
{
name: 'snet-backend-001'
subnetPrefix: '20.0.0.64/26'
}
]
} I use the VNET and SecurityGroup CARML modules. When I try to deploy this template I get the error: "details":[{"code":"LinkedAuthorizationFailed","message":"The client has permission to perform action 'Microsoft.Network/virtualNetworks/write' on scope '/subscriptions/xxxxxx/resourcegroups/network/providers/Microsoft.Network/virtualNetworks/vnet1'; however, the linked property 'properties.subnets[*].properties.networkSecurityGroup.id' has values which are of invalid types 'Object'. However, when I don't the use the CARML modules and use the resource VNET (resource VNET 'Microsoft.Network/virtualNetworks@2021-02-01') it does work. I would like to keep using the CARML modules and understand how this can be solved. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's best to open these issues up directly on the CARML repo directly. |
Beta Was this translation helpful? Give feedback.
-
Link to issue (with solution) at CARML repo: Azure/ResourceModules#3431 |
Beta Was this translation helpful? Give feedback.
It's best to open these issues up directly on the CARML repo directly.
https://github.com/Azure/ResourceModules