Skip to content

Commit 4a4a847

Browse files
committed
Creation of article on outbound rules using Azure PowerShell
1 parent a767d33 commit 4a4a847

File tree

1 file changed

+18
-37
lines changed

1 file changed

+18
-37
lines changed

articles/load-balancer/configure-load-balancer-outbound-powershell.md

Lines changed: 18 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: load-balancer
66
author: asudbring
77
ms.service: load-balancer
88
ms.topic: article
9-
ms.date: 04/01/2019
9+
ms.date: 09/24/2019
1010
ms.author: allensu
1111

1212
---
@@ -108,56 +108,37 @@ $probe = New-AzLoadBalancerProbeConfig -Name http -Protocol "http" -Port 80 -Int
108108
A load balancer rule defines the frontend IP configuration for the incoming traffic and the backend pool to receive the traffic, along with the required source and destination port. Create a load balancer rule *myinboundlbrule* with [New-AzLoadBalancerRuleConfig](https://docs.microsoft.com/powershell/module/az.network/new-azloadbalancerruleconfig?view=azps-2.6.0) for listening to port 80 in the frontend pool *myfrontendinbound* and sending load-balanced network traffic to the backend address pool *bepoolinbound* also using port 80.
109109

110110
>[!NOTE]
111-
>This load balancing rule disables automatic outbound (S)NAT as a result of this rule with the **-DisableOutboundSNAT parameter**. Outbound NAT is only provided by the outbound rule.
112-
113-
```azurecli-interactive
114-
az network lb rule create \
115-
--resource-group myresourcegroupoutbound \
116-
--lb-name lb \
117-
--name inboundlbrule \
118-
--protocol tcp \
119-
--frontend-port 80 \
120-
--backend-port 80 \
121-
--probe http \
122-
--frontend-ip-name myfrontendinbound \
123-
--backend-pool-name bepoolinbound \
124-
--disable-outbound-snat
111+
>This load balancing rule disables automatic outbound (S)NAT as a result of this rule with the **-DisableOutboundSNAT** parameter. Outbound NAT is only provided by the outbound rule.
112+
113+
```azurepowershell-interactive
114+
$inboundRule = New-AzLoadBalancerRuleConfig -Name inboundlbrule -FrontendIPConfiguration $frontendIPin -BackendAddressPool $bepoolin -Probe $probe -Protocol "Tcp" -FrontendPort 80 -BackendPort 80 -IdleTimeoutInMinutes 15 -EnableFloatingIP -LoadDistribution SourceIP -DisableOutboundSNAT
125115
```
126-
### Create Load Balancer
127116

128-
Create a Load Balancer with the inbound IP address using [New-AzLoadBalancer](https://docs.microsoft.com/powershell/module/az.network/new-azloadbalancer?view=azps-2.6.0) named *lb* that includes an inbound frontend IP configuration and a backend pool *bepoolinbound* that is associated with the public IP address *mypublicipinbound* that you created in the preceding step.
117+
### Create outbound rule
129118

130-
```azurepowershell-interactive
119+
An outbound rule defines the frontend public IP, represented by the frontend *myfrontendoutbound*, which will be used for all outbound NAT traffic as well as the backend pool to which this rule applies. Create an outbound rule *myoutboundrule* for outbound network translation of all virtual machines (NIC IP configurations) in *bepool* backend pool. The command below also changes the outbound idle timeout from 4 to 15 minutes and allocates 10000 SNAT ports instead of 1024. Review [New-AzLoadBalancerOutboundRuleConfig](https://docs.microsoft.com/powershell/module/az.network/new-azloadbalanceroutboundruleconfig?view=azps-2.7.0) for more details.
131120

121+
```azurepowershell-interactive
122+
$outboundRule = New-AzLoadBalancerOutBoundRuleConfig -Name outboundrule -FrontendIPConfiguration $frontendIPout -BackendAddressPool $bepoolout -Protocol All -IdleTimeoutInMinutes 15 -AllocatedOutboundPort 10000
132123
```
124+
If you do not want to use a separate outbound pool, you can change the address pool argument in the preceding command to specify *$bepoolin* instead. We recommend to use separate pools for flexibility and readability of the resulting configuration.
133125

126+
### Create Load Balancer
134127

135-
### Create outbound rule
128+
Create a Load Balancer with the inbound IP address using [New-AzLoadBalancer](https://docs.microsoft.com/powershell/module/az.network/new-azloadbalancer?view=azps-2.6.0) named *lb* that includes an inbound frontend IP configuration and a backend pool *bepoolinbound* that is associated with the public IP address *mypublicipinbound* that you created in the preceding step.
136129

137-
An outbound rule defines the frontend public IP, represented by the frontend *myfrontendoutbound*, which will be used for all outbound NAT traffic as well as the backend pool to which this rule applies. Create an outbound rule *myoutboundrule* for outbound network translation of all virtual machines (NIC IP configurations) in *bepool* backend pool. The command below also changes the outbound idle timeout from 4 to 15 minutes and allocates 10000 SNAT ports instead of 1024. Review [outbound rules](https://aka.ms/lboutboundrules) for more details.
138-
139-
```azurecli-interactive
140-
az network lb outbound-rule create \
141-
--resource-group myresourcegroupoutbound \
142-
--lb-name lb \
143-
--name outboundrule \
144-
--frontend-ip-configs myfrontendoutbound \
145-
--protocol All \
146-
--idle-timeout 15 \
147-
--outbound-ports 10000 \
148-
--address-pool bepooloutbound
130+
```azurepowershell-interactive
131+
New-AzLoadBalancer -Name lb -ResourceGroupName myresourcegroupoutbound -Location eastus -FrontendIpConfiguration $frontendIPin,$frontendIPout -BackendAddressPool $bepoolin,$bepoolout -Probe $probe -LoadBalancingRule $inboundrule -OutboundRule $outboundrule
149132
```
150133

151-
If you do not want to use a separate outbound pool, you can change the address pool argument in the preceding command to specify *bepoolinbound* instead. We recommend to use separate pools for flexibility and readability of the resulting configuration.
152-
153-
At this point, you can proceed with adding your VM's to the backend pool *bepoolinbound* __and__ *bepooloutbound* by updating the IP configuration of the respective NIC resources using [az network nic ip-config address-pool add](https://docs.microsoft.com/cli/azure/network/lb/rule?view=azure-cli-latest).
134+
At this point, you can proceed with adding your VM's to the backend pool *bepoolinbound* __and__ *bepooloutbound* by updating the IP configuration of the respective NIC resources using [Add-AzNetworkInterfaceIpConfig](https://docs.microsoft.com/cli/azure/network/lb/rule?view=azure-cli-latest).
154135

155136
## Clean up resources
156137

157-
When no longer needed, you can use the [az group delete](/cli/azure/group#az-group-delete) command to remove the resource group, load balancer, and all related resources.
138+
When no longer needed, you can use the [Remove-AzResourceGroup](https://docs.microsoft.com/powershell/module/az.resources/remove-azresourcegroup?view=azps-2.7.0) command to remove the resource group, load balancer, and all related resources.
158139

159-
```azurecli-interactive
160-
az group delete --name myresourcegroupoutbound
140+
```azurepowershell-interactive
141+
Remove-AzResourceGroup -Name myresourcegroupoutbound
161142
```
162143

163144
## Next steps

0 commit comments

Comments
 (0)