user1716729
user1716729

Reputation: 397

Azure resource manager template

With my ARM code I am trying to build multiple SQL VMs. However, I am hitting brick wall with the following error while tying to create network peering.

[ERROR] New-AzureRmResourceGroupDeployment : 08:40:20 - Error: Code=InvalidTemplate; 
[ERROR] Message=Deployment template validation failed: 'The template resource 
[ERROR] 'DI_SQLSERVER_VNETag5w7jqj6vp3a_TO_DI_DT_VN' for type 
[ERROR] 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings' at line '488' and 
[ERROR] column '9' has incorrect segment lengths. A nested resource type must have 
[ERROR] identical number of segments as its resource name. A root resource type must 
[ERROR] have segment length one greater than its resource name. Please see 
[ERROR] https://aka.ms/arm-template/#resources for usage details.'.
[ERROR] 
[ERROR] At line:35 char:1
[ERROR] + New-AzureRmResourceGroupDeployment -ResourceGroupName $presourcegroup ...
[ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : NotSpecified: (:) [New-AzureRmResourceGroupDeplo 
[ERROR]    yment], Exception
[ERROR]     + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets 
[ERROR]    .Implementation.NewAzureResourceGroupDeploymentCmdlet
[ERROR]  
[ERROR] New-AzureRmResourceGroupDeployment : The deployment validation failed
[ERROR] At line:35 char:1
[ERROR] + New-AzureRmResourceGroupDeployment -ResourceGroupName $presourcegroup ...
[ERROR] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ERROR]     + CategoryInfo          : CloseError: (:) [New-AzureRmResourceGroupDeploym 
[ERROR]    ent], InvalidOperationException
[ERROR]     + FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets 
[ERROR]    .Implementation.NewAzureResourceGroupDeploymentCmdlet
[ERROR] 

Please see the link below for the code. Hope some can shed some light on the following arm template error.

https://drive.google.com/open?id=1Iltf_Qlg9GLPmOKTVDpP2KjrQcLvVZDg

Thanks

Upvotes: 0

Views: 258

Answers (1)

4c74356b41
4c74356b41

Reputation: 72191

your peering name should be this: vnet_name/peering_name, because peering cannot exist on its own (and if you dont provide vnet name it has no way of figuring own what vnet this belongs to), its a sub resource of a vnet resource.

Upvotes: 2

Related Questions