ARM模板,段长度不正确

时间:2018-10-30 23:06:31

标签: azure azure-resource-manager arm-template azure-template

我正在尝试构建ARM模板并不断收到错误消息:

'The template resource 'udr-sub-w05-w05-w05-agw-10.10.10.32/27' for type 
'Microsoft.Network/routeTables' at line '141' and column '5' has incorrect segment lengths. A nested resource type must have identical number of segments as its resource name. A root resource type must 
have segment length one greater than its resource name.

用于创建路由表代码的嵌套模板如下:

{
      "name": "[variables('routeTable1')]",
      "type": "Microsoft.Network/routeTables",
      "apiVersion": "[variables('routeTableApiVersion')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "routes": [
        ],
        "disableBgpRoutePropagation": false
      }
    },
    {
      "name": "[variables('routeTable2')]",
      "type": "Microsoft.Network/routeTables",
      "apiVersion": "[variables('routeTableApiVersion')]",
      "location": "[resourceGroup().location]",
      "properties": {
        "routes": [
        ],
        "disableBgpRoutePropagation": false
      }
    },

您知道哪里出问题了吗?我花了一些时间进行谷歌搜索,我的理解是“ TYPE”的细分应该比“ NAME”的细分少,我相信它的

  "name": "[variables('routeTable1')]",
  "type": "Microsoft.Network/routeTables",

路由表中的一个变量

 "routeTable1": "[tolower(concat('udr-', variables('subnetName1')))]",
 "routeTable2": "[tolower(concat('udr-', variables('subnetName2')))]",

谢谢

1 个答案:

答案 0 :(得分:2)

您的路由表名称包含/,因此它认为您正在尝试创建子资源,并要求您提供其类型(您仅提供父资源类型)。删除/27东西或将其替换为-27或类似的东西。