资源未定义

时间:2018-10-15 21:46:15

标签: azure-resource-manager azure-template

尝试构建ARM模板以部署多个VM。但是,模板验证失败,并显示以下错误消息

  

部署模板验证失败:“资源   在“ Microsoft.Network/networkInterfaces/sqlnodeNic”中未定义   模板。有关用法的详细信息,请参见https://aka.ms/arm-template

{

      "type": "Microsoft.Network/networkInterfaces",
      "apiVersion": "2015-06-15",
      "location": "[resourceGroup().location]",
      "name": "[concat(variables('sqlNodeNicName'),copyIndex())]",
      "dependsOn": [
        "[resourceId('Microsoft.Network/virtualNetworks',variables('vnetname'))]",
        "[concat('Microsoft.Network/publicIPAddresses/', concat(variables('PiPName'),copyIndex()))]"
      ],
      "tags": {
        "displayName": "[concat(variables('sqlNodeNicName'),copyIndex())]"
      },
      "properties": {
        "ipConfigurations": [
          {
            "name": "[concat('ipconfig1',copyIndex())]",
            "properties": {
              "privateIPAllocationMethod": "Dynamic",
              "subnet": {
                "id": "[variables('sqlNodeSubnetRef')]"
              },
              "publicIPAddress": {
                "id": "[concat('Microsoft.Network/publicIPAddresses/', concat(variables('PiPName'),copyIndex()))]"
              }
            }
          }
        ]
      },
      "copy": {
        "name": "nicCopy",
        "count": "[variables('VmCount')]"
      }
    },

1 个答案:

答案 0 :(得分:0)

我无法告诉您代码片段在哪里出现错误(它不会显示问题出在哪里),但是看着此代码片段,您正在生成格式为variable+index的名称,而错误提示某些资源正在寻找名为sqlnodenic的网卡,该网卡显然与您使用的名称不匹配