Azure资源管理器模板

时间:2019-01-14 09:04:59

标签: azure-resource-manager azure-template

使用我的AR​​M代码,我试图构建多个SQL VM。但是,在尝试创建网络对等连接时遇到了以下错误。

[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] 

请参见下面的链接以获取代码。希望一些人可以对以下手臂模板错误有所了解。

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

谢谢

1 个答案:

答案 0 :(得分:2)

您的对等名称应为:vnet_name/peering_name,因为对等不能单独存在(如果您不提供vnet名称,则无法确定自己所属的vnet),因此它是一个子资源vnet资源。