ARM template error
I'm attempting to automate Azure vnet deployments using an ARM template and Powershell script. The problem appears to be with the copy/copyIndex loop for subnet creation. I can't figure out how to resolve the error. Please find the error message below for the template files that is attached. Help Please!!! test_json.txt
New-AzResourceGroupDeployment : 5:46:56 PM - The deployment 'test' failed with error(s). Showing 1 out of 1 error(s).
Status Message: Unable to process template language expressions for resource
'/subscriptions/RemovedSubscriptionId/resourceGroups/RG-AZNetworkAutomation/providers/Microsoft.Network/virtualNetworks/ernest_vnet0' at line '45'
and column '9'. 'The template language function 'copyIndex' has an invalid argument. The provided copy name 'subnetCopy' doesn't exist in the resource. Please see
https://aka.ms/arm-resource-loops for usage details.' (Code:InvalidTemplate)
CorrelationId: b0f0c1bd-db69-4e8f-976c-89a35433608a
At C:\Users\Ernest\Documents\Azure\AZ104_Study\test_deploy.ps1:45 char:1
- New-AzResourceGroupDeployment -ResourceGroupName RG-AZNetworkAtomatio ...
-
+ CategoryInfo : NotSpecified: (:) [New-AzResourceGroupDeployment], Exception + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet