我尝试通过powershell在azure上创建一个负载均衡器,但是如果我使用来自不同资源组的现有vnet,我会收到错误。 (并非所有负载均衡器引用的后端IP配置)。以后应将负载均衡器用于VM Scale Set。
但我没有为BackendAddressPoolConfig设置v-net和IP,我也看不到如何做到这一点。
$vnet= Get-AzureRmVirtualNetwork -Name $vnetname -ResourceGroupName $vnetrg -ErrorAction Stop
$subnetMain = $vnet.Subnets[2]
$subNetName = $subnetMain.Name
$frontendIP = New-AzureRmLoadBalancerFrontendIpConfig -Name LB-Frontend `
-SubnetId $subnetMain.Id
$beaddresspool= New-AzureRmLoadBalancerBackendAddressPoolConfig -Name "LB-backend"
$inboundNATRule1= New-AzureRmLoadBalancerInboundNatRuleConfig -Name "RDP" `
-FrontendIpConfiguration $frontendIP `
-Protocol TCP `
-FrontendPort 3389 `
-BackendPort 3389
$healthProbe = New-AzureRmLoadBalancerProbeConfig -Name "HealthProbe" `
-RequestPath "Default.htm" `
-Protocol http -Port 80 `
-IntervalInSeconds 15 `
-ProbeCount 2
$lbrule = New-AzureRmLoadBalancerRuleConfig -Name "HTTP" `
-FrontendIpConfiguration $frontendIP `
-BackendAddressPool $beAddressPool `
-Probe $healthProbe `
-Protocol Tcp `
-FrontendPort 80 `
-BackendPort 80
$nrplb = New-AzureRmLoadBalancer -ResourceGroupName $currentrg `
-Name "NRP-LB" `
-Location $loc `
-FrontendIpConfiguration $frontendIP `
-InboundNatRule $inboundNATRule1 `
-LoadBalancingRule $lbrule `
-BackendAddressPool $beAddressPool `
-Probe $healthProbe
我必须设置后端的IP配置吗?但是怎么样?或者是出了什么问题?
答案 0 :(得分:0)
今天发布了Azure Powershell的新版本6.2.1。这解决了问题。