summary import { LoadBalancerVipSwapRequest , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function swapViPsBetweenTwoLoadBalancers ( ) { const subscriptionId = "subid" ; const location = "westus" ; const parameters = { frontendIPConfigurations : [ { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb1/frontendIPConfigurations/lbfe1" , publicIPAddress : { id : "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/publicIPAddresses/pip2" } } , { id : "/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/loadBalancers/lb2/frontendIPConfigurations/lbfe2" , publicIPAddress : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip1" } } ] } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . loadBalancers . beginSwapPublicIpAddressesAndWait ( location , parameters ) ; console . log ( result ) ; } swapViPsBetweenTwoLoadBalancers ( ) . catch ( console . error ) ;