Raghu K Nair
Raghu K Nair

Reputation: 3942

Update an existing Azure load balancer with a new rule fails

I am trying to update an existing Loadbalancer with new Rule.

I am executing the following command as per the documentation from microsoft. https://learn.microsoft.com/en-us/azure/load-balancer/load-balancer-get-started-internet-arm-ps#update-an-existing-load-balancer

$slb = Get-AzureRmLoadBalancer -Name  LB-Some-primary -ResourceGroupName SomeName
$slb | Add-AzureRmLoadBalancerInboundNatRuleConfig -Name "Test" -FrontendIpConfiguration $slb.FrontendIpConfigurations[0] -FrontendPort 29700 -BackendPort 24700 -Protocol TCP
$slb | Set-AzureRmLoadBalancer

I get the following error

Set-AzureRmLoadBalancer : Adding or updating NAT Rules when NAT pool is present on loadbalancer /subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxx/providers/Microsoft.Network/loadBalancers/LB-xxxx-primary is not supported. To modify the load balancer, pass 
in all NAT rules unchanged or remove the LoadBalancerInboundNatRules property from your PUT request.
StatusCode: 400
ReasonPhrase: Bad Request
OperationID : 'xxxx-2596-4c9e-a30a-12be70fxxxxx'
At line:1 char:8
+ $slb | Set-AzureRmLoadBalancer
+        ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Set-AzureRmLoadBalancer], NetworkCloudException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.SetAzureLoadBalancerCommand

I get the same error from Azure CLI as well.

Upvotes: 1

Views: 2410

Answers (1)

Jason Ye
Jason Ye

Reputation: 13974

According to your description, it seems like you want to add NAT rules to VMSS' Load Balancer.

But for now, adding or editing references between load balancers and scale set virtual machines is currently disabled for load balancers that contain an existing association with a scale set.

The command complains because you're trying to add a rule to something already configured with a pool.

If you want to add NAT rules to VMSS' Load Balancer, we should redeploy it with new configure. VMSS are configured slightly different than individual VM's. VMSS use pools for NAT rules rather than individual rules, more information about VMSS' Load Balancer, please refer to this link.

Upvotes: 1

Related Questions