Change:
assert.Equal(t, test.expected, real, test.desc) } } <ins> func TestIsBackendPoolOnSameLB(t *testing.T) { tests := []struct { backendPoolID        string existingBackendPools []string expected             bool expectedLBName       string expectError          bool }{ { backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool1", existingBackendPools: []string{ "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool2", }, expected:       true, expectedLBName: "", }, { backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1-internal/backendAddressPools/pool1", existingBackendPools: []string{ "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool2", }, expected:       true, expectedLBName: "", }, { backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool1", existingBackendPools: []string{ "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1-internal/backendAddressPools/pool2", }, expected:       true, expectedLBName: "", }, { backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool1", existingBackendPools: []string{ "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb2/backendAddressPools/pool2", }, expected:       false, expectedLBName: "lb2", }, { backendPoolID: "wrong-backendpool-id", existingBackendPools: []string{ "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool2", }, expectError: true, }, { backendPoolID: "/subscriptions/sub/resourceGroups/rg/providers/Microsoft.Network/loadBalancers/lb1/backendAddressPools/pool1", existingBackendPools: []string{ "wrong-existing-backendpool-id", }, expectError: true, }, { backendPoolID: "wrong-backendpool-id", existingBackendPools: []string{ "wrong-existing-backendpool-id", }, expectError: true, }, } for _, test := range tests { isSameLB, lbName, err := isBackendPoolOnSameLB(test.backendPoolID, test.existingBackendPools) if test.expectError { assert.Error(t, err) continue } assert.Equal(t, test.expected, isSameLB) assert.Equal(t, test.expectedLBName, lbName) } } </ins>

Discussion:
<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks! If the matter is security related, please disclose it privately via --What happened: SLB backend pools are empty if outbound rules are defined in a separate backend pool. This is because, although we the check for not adding the backend pools from different LBs, the lbName is not checked: The new backend pool's lbName should be also checked in above codes. What you expected to happen: SLB backend pools should be updated correctly when outbound rules are defined in a separate backend pool. How to reproduce it (as minimally and precisely as possible): Anything else we need to know?: Environment: Kubernetes version (use ): Cloud provider or hardware configuration: OS (e.g: ): Kernel (e.g. ): Install tools: Others: /sig azure /kind bug /assign