【问题标题】:How to set private ip using json template in Azure resource manager portal?如何在 Azure 资源管理器门户中使用 json 模板设置私有 ip?
【发布时间】:2016-02-28 08:07:40
【问题描述】:

我正在使用 Azure 资源管理器门户。我已经使用 json 模板创建了 vm。但是vm的本地ip地址的顺序发生了变化。 `我的要求是 10.0.0.4,10.0.0.5,10.0.0.6。 但输出是 10.0.0.5, 10.0.0.6,10.0.0.4

我尝试使用 json 设置私有 IP 地址

"properties": {
    "ipConfigurations": [
      {
        "name": "ipconfig1",
        "properties": {
          "privateIPAllocationMethod": "static",
          "PrivateIpAddress": [concat("10.0.0."), copyindex())],
          "copy": { 
                "name": "ipaddress", 
                "count": "["[variables('numberOfInstances')]"]" 
            }, 
          "subnet": {
            "id": "[variables('subnetRef')]"
          },
          "loadBalancerBackendAddressPools": [
            {
              "id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
            }
          ],
          "loadBalancerInboundNatRules": [
            {
              "id": "[concat(variables('lbID'),'/inboundNatRules/RDP-VM', copyindex())]"
            }
          ]
        }
      }
    ]
  }
},

但它会引发 json 解析异常。有人知道如何在 json 模板中设置私有 IP 地址吗?

【问题讨论】:

    标签: json azure


    【解决方案1】:

    我认为问题在于:

    "PrivateIpAddress": [concat("10.0.0."), copyindex())],
    

    copyindex() 给你0 和第一个VM

    而且你不能在 Azure 中使用10.0.0.0-3

    Use copyindex(4)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-05-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多