From 71494c0bd9aae9962c6f681c844a82e18db97a79 Mon Sep 17 00:00:00 2001
From: Zim Kalinowski <zikalino@microsoft.com>
Date: Mon, 22 Apr 2019 10:27:08 +0800
Subject: [PATCH] fixing lb / ag replacement (#55546)

---
 .../modules/cloud/azure/azure_rm_virtualmachinescaleset.py  | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
index fdd89191a86..040bb4697b5 100644
--- a/lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
+++ b/lib/ansible/modules/cloud/azure/azure_rm_virtualmachinescaleset.py
@@ -839,9 +839,15 @@ class AzureRMVirtualMachineScaleSet(AzureRMModuleBase):
                                 .ip_configurations[0].load_balancer_backend_address_pools = load_balancer_backend_address_pools
                             vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
                                 .ip_configurations[0].load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools
+                            vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+                                .ip_configurations[0].application_gateway_backend_address_pools = None
                         elif self.application_gateway:
                             vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
                                 .ip_configurations[0].application_gateway_backend_address_pools = application_gateway_backend_address_pools
+                            vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+                                .ip_configurations[0].load_balancer_backend_address_pools = None
+                            vmss_resource.virtual_machine_profile.network_profile.network_interface_configurations[0] \
+                                .ip_configurations[0].load_balancer_inbound_nat_pools = None
 
                     if self.data_disks is not None:
                         data_disks = []