Hi All,
I'm attempting to use the copy function within variables section of an ARM template. I'm trying to dynamically assign x number of NICs on VirtualMachineProfile inside the NetworkProfile. This is to enable open networking mode: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-networking-modes.
This is my variable:
"Copy":[{"name": "networkInterfaceConfigurations","count": "[parameters('SFAdditionalNICs')]","input": {"name": "[concat(variables('sfNodeNicName'), '-', copyIndex('networkInterfaceConfigurations'))]","properties": {"ipConfigurations": [ {"name": "[concat(variables('sfNodeNicName'), '-', copyIndex('networkInterfaceConfigurations'))]","properties": {"primary": "[if(greater(copyIndex('networkInterfaceConfigurations'), 0), 'false', 'true')]","loadBalancerBackendAddressPools": [{"id": "[variables('lbPoolID0')]"}],"loadBalancerInboundNatPools": [{"id": "[variables('lbNatPoolID0')]"}],"subnet": {"id": "[variables('subnet0Ref')]"} } } ] } } } ]
and this is how I've applied it:
"networkProfile": {"networkInterfaceConfigurations": "[variables('networkInterfaceConfigurations')]" },
I'm getting the following error which suggests the variable is not being recognized:
VM scale set NetworkProfile must have exactly one NetworkInterfaceConfiguration with primary property set to true. VM scale set NetworkProfile /subscriptions/124e0329-b994-45b6-9ad5-a8c7ca40f282/resourceGroups/ATLASDEV21-RG/providers/Microsoft.Compute/virtualMachineScaleSets/atldev21isf-vmss/updateGroups/ee26fc51-2bac-4018-920c-7c69490e6457 has 0 primary NetworkInterfaceConfigurations."
I've referenced the following examples
https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-multiple
https://azurecitadel.com/automation/arm/lab5/
https://stackoverflow.com/questions/49629408/azure-arm-template-copy-array-to-object-array