ARM template error

Ernest Hedgepeth 0 Reputation points
2024-08-06T21:58:48.2833333+00:00

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
    
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,525 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,620 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.