You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- This quickstart requires version 2.0.28 or later of the Azure CLI. If using Azure Cloud Shell, the latest version is already installed.
25
+
## Prerequisites
28
26
29
27
- A standard public load balancer in your subscription. For more information on creating an Azure Load Balancer, see [Quickstart: Create a public load balancer to load balance VMs using the Azure portal](quickstart-load-balancer-standard-public-portal.md). The load balancer name for the examples in this article is **myLoadBalancer**.
- If you choose to install and use PowerShell locally, this article requires the Azure PowerShell module version 5.4.1 or later. Run `Get-Module -ListAvailable Az` to find the installed version. If you need to upgrade, see [Install Azure PowerShell module](/powershell/azure/install-Az-ps). If you're running PowerShell locally, you also need to run `Connect-AzAccount` to create a connection with Azure.
32
+
31
33
## Add a single VM inbound NAT rule
32
34
33
35
# [**Portal**](#tab/inbound-nat-rule-portal)
34
36
35
-
In this example, you'll create an inbound NAT rule to forward port 500 to backend port 443.
37
+
In this example, you'll create an inbound NAT rule to forward port **500** to backend port **443**.
36
38
37
39
1. Sign in to the [Azure portal](https://portal.azure.com).
38
40
@@ -64,9 +66,41 @@ In this example, you'll create an inbound NAT rule to forward port 500 to backen
64
66
65
67
:::image type="content" source="./media/manage-inbound-nat-rules/add-single-instance-rule.png" alt-text="Screenshot of the create inbound NAT rule page":::
In this example, you'll create an inbound NAT rule to forward port 500 to backend port 443.
103
+
In this example, you'll create an inbound NAT rule to forward port **500** to backend port **443**.
70
104
71
105
Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-create) to create the NAT rule.
72
106
@@ -87,7 +121,7 @@ Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-ru
87
121
88
122
# [**Portal**](#tab/inbound-nat-rule-portal)
89
123
90
-
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443.
124
+
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443. The maximum number of machines in the backend pool is set by the parameter **Maximum number of machines in backend pool** with a value of **500**. This setting will limit the backend pool to **500** virtual machines.
91
125
92
126
1. Sign in to the [Azure portal](https://portal.azure.com).
93
127
@@ -110,17 +144,51 @@ In this example, you'll create an inbound NAT rule to forward a range of ports s
110
144
| Target backend pool | Select your backend pool. In this example, it's **myBackendPool**. |
111
145
| Frontend IP address | Select your frontend IP address. In this example, it's **myFrontend**. |
112
146
| Frontend port range start | Enter **500**. |
113
-
| Maximum number of machines in backend pool | Enter **1000**. |
147
+
| Maximum number of machines in backend pool | Enter **500**. |
114
148
| Backend port | Enter **443**. |
115
149
| Protocol | Select **TCP**. |
116
150
117
151
7. Leave the rest at the defaults and select **Add**.
118
152
119
153
:::image type="content" source="./media/manage-inbound-nat-rules/add-inbound-nat-rule.png" alt-text="Screenshot of the add inbound NAT rules page":::
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443. The maximum number of machines in the backend pool is set by the parameter `-FrontendPortRangeEnd` with a value of **1000**. This setting will limit the backend pool to **500** virtual machines.
158
+
159
+
Use [Get-AzLoadBalancer](/powershell/module/az.network/get-azloadbalancer) to place the load balancer information into a variable.
160
+
161
+
Use [Add-AzLoadBalancerInboundNatRuleConfig](/powershell/module/az.network/add-azloadbalancerinboundnatruleconfig) to create the inbound NAT rule.
162
+
163
+
To save the configuration to the load balancer, use [Set-AzLoadBalancer](/powershell/module/az.network/set-azloadbalancer)
164
+
165
+
```azurepowershell
166
+
## Place the load balancer information into a variable for later use. ##
167
+
$slb = @{
168
+
ResourceGroupName = 'myResourceGroup'
169
+
Name = 'myLoadBalancer'
170
+
}
171
+
$lb = Get-AzLoadBalancer @slb
172
+
173
+
## Create the multiple virtual machines inbound NAT rule. ##
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443.
191
+
In this example, you'll create an inbound NAT rule to forward a range of ports starting at port 500 to backend port 443. The maximum number of machines in the backend pool is set by the parameter `--frontend-port-range-end` with a value of **1000**. This setting will limit the backend pool to **500** virtual machines.
124
192
125
193
Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-create) to create the NAT rule.
126
194
@@ -144,7 +212,7 @@ Use [az network lb inbound-nat-rule create](/cli/azure/network/lb/inbound-nat-ru
144
212
145
213
# [**Portal**](#tab/inbound-nat-rule-portal)
146
214
147
-
To accommodate more virtual machines in the backend pool in a multiple instance rule, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the frontend port allocation from 500 to 1000.
215
+
To accommodate more virtual machines in the backend pool in a multiple instance rule, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the **Maximum number of machines in backend pool**from **500** to **1000**. This setting will increase the maximum number of machines in the backend pool to **1000**.
148
216
149
217
1. Sign in to the [Azure portal](https://portal.azure.com).
150
218
@@ -158,21 +226,51 @@ To accommodate more virtual machines in the backend pool in a multiple instance
158
226
159
227
:::image type="content" source="./media/manage-inbound-nat-rules/select-inbound-nat-rule.png" alt-text="Screenshot of inbound NAT rule overview.":::
160
228
161
-
6. In the properties of the inbound NAT rule, change the value in **Frontend port range start** to **1000**.
229
+
6. In the properties of the inbound NAT rule, change the value in **Maximum number of machines in backend pool** to **1000**.
162
230
163
231
7. Select **Save**.
164
232
165
233
:::image type="content" source="./media/manage-inbound-nat-rules/change-frontend-ports.png" alt-text="Screenshot of inbound NAT rule properties page.":::
To accommodate more virtual machines in the backend pool in a multiple instance rule, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the parameter `-FrontendPortRangeEnd` to **1500**. This setting will increase the maximum number of machines in the backend pool to **1000**.
238
+
239
+
Use [Get-AzLoadBalancer](/powershell/module/az.network/get-azloadbalancer) to place the load balancer information into a variable.
240
+
241
+
To change the port allocation, use [Set-AzLoadBalancerInboundNatRuleConfig](/powershell/module/az.network/set-azloadbalancerinboundnatruleconfig).
242
+
243
+
```azurepowershell
244
+
## Place the load balancer information into a variable for later use. ##
To accommodate more virtual machines in the backend pool, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the frontend port allocation from 500 to 1000.
267
+
To accommodate more virtual machines in the backend pool, change the frontend port allocation in the inbound NAT rule. In this example, you'll change the parameter `--frontend-port-range-end` to **1500**. This setting will increase the maximum number of machines in the backend pool to **1000**
170
268
171
269
Use [az network lb inbound-nat-rule update](/cli/azure/network/lb/inbound-nat-rule#az-network-lb-inbound-nat-rule-update) to change the frontend port allocation.
172
270
173
271
```azurecli
174
272
az network lb inbound-nat-rule update \
175
-
--frontend-port-range-start 1000 \
273
+
--frontend-port-range-end 1500 \
176
274
--lb-name myLoadBalancer \
177
275
--name myInboundNATrule \
178
276
--resource-group myResourceGroup
@@ -183,7 +281,7 @@ Use [az network lb inbound-nat-rule update](/cli/azure/network/lb/inbound-nat-ru
183
281
184
282
## View port mappings
185
283
186
-
Port mappings for the virtual machines in the backend pool can be viewed by using the Azure portal. In this example, you'll use the Azure portal to view the port mappings:
284
+
Port mappings for the virtual machines in the backend pool can be viewed by using the Azure portal.
187
285
188
286
1. Sign in to the [Azure portal](https://portal.azure.com).
189
287
@@ -221,11 +319,36 @@ In this example, you'll remove an inbound NAT rule.
221
319
222
320
:::image type="content" source="./media/manage-inbound-nat-rules/remove-inbound-nat-rule.png" alt-text="Screenshot of inbound NAT rule removal.":::
In this example, you'll remove an inbound NAT rule.
325
+
326
+
Use [Get-AzLoadBalancer](/powershell/module/az.network/get-azloadbalancer) to place the load balancer information into a variable.
327
+
328
+
To remove the inbound NAT rule, use [Remove-AzLoadBalancerInboundNatRuleConfig](/powershell/module/az.network/remove-azloadbalancerinboundnatruleconfig).
329
+
330
+
To save the configuration to the load balancer, use [Set-AzLoadBalancer](/powershell/module/az.network/set-azloadbalancer).
331
+
332
+
```azurepowershell
333
+
## Place the load balancer information into a variable for later use. ##
0 commit comments