Azure 负载均衡器 - 使用 ARM 模板将现有 VM 添加到 Azure 负载均衡器
Azure Load balancer - Add existing VMs to Azure Load Balancer with ARM template
我有两个 VMS backendvm0 和 backendvm1,我正在尝试将这些 Vms 从 Load balancer ARM 模板部署添加到 Azure 负载均衡器的后端池。我正在使用如下参数对象。它没有给出任何错误,正在创建名称为 tlba001backendpool_test 的负载平衡器,但它没有显示任何附加到它的虚拟机。
"backendAddressPools": {
"value": [
{
"name": "tlba001backendpool_test",
"id": "",
"properties": {
"loadBalancerBackendAddresses": [
{
"name": "backendvm0",
"properties": {
"ipAddress": "10.0.2.5"
}
},
{
"name": "backendvm1",
"properties": {
"ipAddress": "10.0.2.4"
}
}
]
}
}
]
},
enter image description here
因为这是由 nic 属性而不是负载平衡器控制的,所以您需要修改 NIC 属性并将 NIC 分配给负载平衡器。
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(parameters('nicNamePrefix'), copyindex())]",
"location": "[resourceGroup().location]",
"copy": {
"name": "nicLoop",
"count": "[variables('numberOfInstances')]"
},
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
"[concat('Microsoft.Network/loadBalancers/', parameters('lbName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
}
]
}
}
]
}
}
我有两个 VMS backendvm0 和 backendvm1,我正在尝试将这些 Vms 从 Load balancer ARM 模板部署添加到 Azure 负载均衡器的后端池。我正在使用如下参数对象。它没有给出任何错误,正在创建名称为 tlba001backendpool_test 的负载平衡器,但它没有显示任何附加到它的虚拟机。
"backendAddressPools": {
"value": [
{
"name": "tlba001backendpool_test",
"id": "",
"properties": {
"loadBalancerBackendAddresses": [
{
"name": "backendvm0",
"properties": {
"ipAddress": "10.0.2.5"
}
},
{
"name": "backendvm1",
"properties": {
"ipAddress": "10.0.2.4"
}
}
]
}
}
]
},
enter image description here
因为这是由 nic 属性而不是负载平衡器控制的,所以您需要修改 NIC 属性并将 NIC 分配给负载平衡器。
{
"apiVersion": "2015-05-01-preview",
"type": "Microsoft.Network/networkInterfaces",
"name": "[concat(parameters('nicNamePrefix'), copyindex())]",
"location": "[resourceGroup().location]",
"copy": {
"name": "nicLoop",
"count": "[variables('numberOfInstances')]"
},
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', parameters('vnetName'))]",
"[concat('Microsoft.Network/loadBalancers/', parameters('lbName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": {
"id": "[variables('subnetRef')]"
},
"loadBalancerBackendAddressPools": [
{
"id": "[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]"
}
]
}
}
]
}
}