创建内部负载均衡器,其中私有IP地址在模板中面临错误 [英] Create internal loadbalancer with private ip address facing error in template

查看:78
本文介绍了创建内部负载均衡器,其中私有IP地址在模板中面临错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,

我写了一个模板来创建具有私有IP的内部负载均衡器但我面临以下错误,我也提到了我的ARM模板脚本。 

I written a template to create internal Loadbalancer with private IP But I am facing below error and I am mention my ARM Template script also. 

错误: 请求内容无效且无法反序列化:'无法在"模板"类型的对象上找到成员'输出'。路径'properties.template.output',第179行,第15位。'。 (代码:InvalidRequestContent)

在上面的错误行中显示179但在模板中没有超过160行。

In above error line showing 179 but in template not crossed 160 Lines.

{

 " $ schema":" https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#" ;,

  ;" contentVersion" ;:" 1.0.0.0" ;,

 "参数" ;: {

  " vnetAddressPrefix" ;: {

   "类型" ;:"字符串" ;,

   "默认值" ;:" 10.0.0.0/16" ;,

   ""metadata":{
$
    " description":" address prefix"

  }

  },

  " VirtualNetworkName":{

   " type":" string"

  },

  " SubnetName":{

   " type&quo t;:" string"

  },

  " LoadBalancerName":{

   ; " type":" string"

  },

  " Tags":{

   " type":" string"

  },

  " SKU":{

   " type":" string"

  },

  " subnetPrefix" ;: {

   " type":" string",

   " defaultValue":" 10.0 .0.0 / 24",

   " metadata":{

    " description":" Subnet前缀"

   }

  },

  " location":{

   " type":" string",

   " defaultValue ":" [resourceGroup()。location]",

   " metadata":{

     ;"描述":"所有资源的位置"。

   }

  }

 },

 "变量":{

  " virtualNetworkName":" virtualNetwork1",

  " subnetName":" subnet1",

  " loadBalancerName":" loadBalancer1",

  " ; NICNAME" ;:" networkInterface1" ;,

  " subnetRef" ;:" [RESOURCEID( 'Microsoft.Network/virtualNetworks/subnets',变量( 'virtualNetworkName'),变量( 'subnetName'))]"

 },

 ""resources":[{

    ;"apiVersion":"2015-06-15",&b $ b   " type":" Microsoft。网络/虚拟网络",
   " name":" [variables('virtualNetworkName')]",$
     ;"location":" [parameters('location')]",
   " properties":{

               ;  "地址空间" ;: {

     " addressPrefixes" ;: [

   &NBSP ;  " [parameters('vnetAddressPrefix')]"

     ]

     },

    " subnets":[{

     " name": "[variables('subnetName')]",

     " properties":{
$
    ;   " addressPrefix":" [parameters('subnetPrefix')]"

     }

     ;}]¥b $ b   }

  },

   {

   " apiVersion":" 2015-06-15",

   " type":" Microsoft.Network/networkInterfaces" ,

   " name":" [variables('nicName')]",

   " location" ;:" [parameters('location')]",
   " dependsOn":[

     ;"[concat('Microsoft.Network/loadBalancers/',变量('loadBalancerName'))]"
$
   ],

  ;  " properties":{

    " ipConfigurations":[{

      """""""" ipconfig1",&
     " properties":{

       " privateIPAllocationMethod":& "动态",&
      " subnet":{

       ; "" id":" [variables('subnetRef')]"

      },

      " loadBalancerBackendAddressPools" ;: [{

       " ID" ;:" [CONCAT (RESOURCEID( 'Microsoft.Network/loadBalancers',变量( 'loadBalancerName')), '/ backendAddressPools / loadBalancerBackEnd')]"

      } ]¥b $ b     }

    }]

    }

  },

   {

   " apiVersion":" ; 2015-06-15",

   " name":" [variables('loadBalancerName')]",
    " type":" Microsof t.Network/loadBalancers",

   " location":" [parameters('location')]",$
    ; " dependsOn":[

    " [concat('Microsoft.Network/virtualNetworks /',variables('virtualNetworkName'))]"

   ],

   " properties":{

     ;"frontendIPConfigurations":[{

     " name":" loadBalancerFrontEnd",

      " properties" ;: {

      " subnet":{

        " id":" [variables('subnetRef')]"
$
      }

     }

    }],

     " backendAddressPools" ;: [{

     "名称" ;:" loadBalancerBackEnd"

&NBSP;&NBSP;&NBSP;&NBSP;}],<无线电通信/>
    " loadBalancingRules":[{

     " properties":{

      " frontendIPConfiguration":{
$
       " id":" [CONCAT(RESOURCEID( 'Microsoft.Network/loadBalancers',变量( 'loadBalancerName')), '/ frontendIpConfigurations / loadBalancerFrontEnd')]"

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;},

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;" backendAddressPool" ;: {

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ;" ID" ;:" [CONCAT(RESOURCEID( 'Microsoft.Network/loadBalancers',变量( 'loadBalancerName')), '/ backendAddressPools / loadBalancerBackEnd')]"

&NBSP;&NBSP ;    },

 &nb sp;    " probe" ;: {
$
       " id":" [concat(resourceId( 'Microsoft.Network/loadBalancers',变量('loadBalancerName')),'/ probes / lbprobe')]" b $ b      },

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;"协议" ;:" TCP" ;,

&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;" frontendPort":80,

      " backendPort":80,

       " idleTimeoutInMinutes" ;:15

     },

     " name" :"lbrule"&
    }],

    " probes":[{

     " properties" ;: {

      " protocol":" Tcp" ,

 &nbs p;    " port":80,

      " intervalInSeconds":15,

      " numberOfProbes" ;: 2

     },

      " name":" lbprobe"

    }]
   }

  }

 ],

 "输出":{

  ; " loadbalancerName" ;: {

   " type":" string",

   " value" ;:" [parameters('loadbalancerName')]"

  },

  " privateIP":{

   "" type":" string",

   " value":" [parameters('privateIP')]" ; $
  },

  " vnetid":{

&nbs p;  "" type":" string",

   " value":" [parameters('vnetid')]"

  },

  " subnetid" ;: {
$
   " type":"字符串",

   " value":" [parameters('subnetid')]"

  }

 }

}

{
 "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
 "contentVersion": "1.0.0.0",
 "parameters": {
  "vnetAddressPrefix": {
   "type": "string",
   "defaultValue": "10.0.0.0/16",
   "metadata": {
    "description": "address prefix"
   }
  },
  "VirtualNetworkName": {
   "type": "string"
  },
  "SubnetName": {
   "type": "string"
  },
  "LoadBalancerName": {
   "type": "string"
  },
  "Tags": {
   "type": "string"
  },
  "SKU": {
   "type": "string"
  },
  "subnetPrefix": {
   "type": "string",
   "defaultValue": "10.0.0.0/24",
   "metadata": {
    "description": "Subnet prefix"
   }
  },
  "location": {
   "type": "string",
   "defaultValue": "[resourceGroup().location]",
   "metadata": {
    "description": "Location for all resources."
   }
  }
 },
 "variables": {
  "virtualNetworkName": "virtualNetwork1",
  "subnetName": "subnet1",
  "loadBalancerName": "loadBalancer1",
  "nicName": "networkInterface1",
  "subnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('virtualNetworkName'), variables('subnetName'))]"
 },
 "resources": [{
   "apiVersion": "2015-06-15",
   "type": "Microsoft.Network/virtualNetworks",
   "name": "[variables('virtualNetworkName')]",
   "location": "[parameters('location')]",
   "properties": {
    "addressSpace": {
     "addressPrefixes": [
      "[parameters('vnetAddressPrefix')]"
     ]
    },
    "subnets": [{
     "name": "[variables('subnetName')]",
     "properties": {
      "addressPrefix": "[parameters('subnetPrefix')]"
     }
    }]
   }
  },
  {
   "apiVersion": "2015-06-15",
   "type": "Microsoft.Network/networkInterfaces",
   "name": "[variables('nicName')]",
   "location": "[parameters('location')]",
   "dependsOn": [
    "[concat('Microsoft.Network/loadBalancers/', variables('loadBalancerName'))]"
   ],
   "properties": {
    "ipConfigurations": [{
     "name": "ipconfig1",
     "properties": {
      "privateIPAllocationMethod": "Dynamic",
      "subnet": {
       "id": "[variables('subnetRef')]"
      },
      "loadBalancerBackendAddressPools": [{
       "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')),'/backendAddressPools/loadBalancerBackEnd')]"
      }]
     }
    }]
   }
  },
  {
   "apiVersion": "2015-06-15",
   "name": "[variables('loadBalancerName')]",
   "type": "Microsoft.Network/loadBalancers",
   "location": "[parameters('location')]",
   "dependsOn": [
    "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
   ],
   "properties": {
    "frontendIPConfigurations": [{
     "name": "loadBalancerFrontEnd",
     "properties": {
      "subnet": {
       "id": "[variables('subnetRef')]"
      }
     }
    }],
    "backendAddressPools": [{
     "name": "loadBalancerBackEnd"
    }],
    "loadBalancingRules": [{
     "properties": {
      "frontendIPConfiguration": {
       "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/frontendIpConfigurations/loadBalancerFrontEnd')]"
      },
      "backendAddressPool": {
       "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/backendAddressPools/loadBalancerBackEnd')]"
      },
      "probe": {
       "id": "[concat(resourceId('Microsoft.Network/loadBalancers', variables('loadBalancerName')), '/probes/lbprobe')]"
      },
      "protocol": "Tcp",
      "frontendPort": 80,
      "backendPort": 80,
      "idleTimeoutInMinutes": 15
     },
     "name": "lbrule"
    }],
    "probes": [{
     "properties": {
      "protocol": "Tcp",
      "port": 80,
      "intervalInSeconds": 15,
      "numberOfProbes": 2
     },
     "name": "lbprobe"
    }]
   }
  }
 ],
 "output": {
  "loadbalancerName": {
   "type": "string",
   "value": "[parameters('loadbalancerName')]"
  },
  "privateIP": {
   "type": "string",
   "value": "[parameters('privateIP')]"
  },
  "vnetid": {
   "type": "string",
   "value": "[parameters('vnetid')]"
  },
  "subnetid": {
   "type": "string",
   "value": "[parameters('subnetid')]"
  }
 }
}

问候

Venkat

关心Venkat

推荐答案

你非常接近!只需将"输出"更改为"输出",您就可以解决您遇到的问题。

You're very close! Just change 'output' to 'outputs' and you should get past the problem you're having.

您也可以考虑为SKU参数定义'allowedValues',以降低其可能性用户提交无效值。

You might also consider defining 'allowedValues' for the SKU parameter, to make it less likely that the user submits an invalid value.

问候,

Jonathan(www.Opsgility.com)

Jonathan (www.Opsgility.com)

PS。如果有帮助,请记得'标记为答案'!

PS. Please remember to 'mark as answer' if this helps!


这篇关于创建内部负载均衡器,其中私有IP地址在模板中面临错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆