summary import { LoadBalancer , NetworkManagementClient } from "@msinternal/network-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createLoadBalancerWithOutboundRules ( ) { const subscriptionId = "subid" ; const resourceGroupName = "rg1" ; const loadBalancerName = "lb" ; const parameters = { backendAddressPools : [ { name : "be-lb" } ] , frontendIPConfigurations : [ { name : "fe-lb" , publicIPAddress : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip" } } ] , inboundNatPools : [ ] , inboundNatRules : [ { name : "in-nat-rule" , backendPort : 3389 , enableFloatingIP : true , frontendIPConfiguration : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb" } , frontendPort : 3389 , idleTimeoutInMinutes : 15 , protocol : "Tcp" } ] , loadBalancingRules : [ { name : "rulelb" , backendAddressPool : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb" } , backendPort : 80 , disableOutboundSnat : true , enableFloatingIP : true , frontendIPConfiguration : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb" } , frontendPort : 80 , idleTimeoutInMinutes : 15 , loadDistribution : "Default" , probe : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/probes/probe-lb" } , protocol : "Tcp" } ] , location : "eastus" , outboundRules : [ { name : "rule1" , backendAddressPool : { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/backendAddressPools/be-lb" } , frontendIPConfigurations : [ { id : "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb/frontendIPConfigurations/fe-lb" } ] , protocol : "All" } ] , probes : [ { name : "probe-lb" , intervalInSeconds : 15 , numberOfProbes : 2 , port : 80 , requestPath : "healthcheck.aspx" , protocol : "Http" } ] , sku : { name : "Standard" } } ; const credential = new DefaultAzureCredential ( ) ; const client = new NetworkManagementClient ( credential , subscriptionId ) ; const result = await client . loadBalancers . beginCreateOrUpdateAndWait ( resourceGroupName , loadBalancerName , parameters ) ; console . log ( result ) ; } createLoadBalancerWithOutboundRules ( ) . catch ( console . error ) ;