Skip to content

Commit 46ab572

Browse files
authored
Merge pull request #189380 from thisisanniefang/patch-18
Add NIC IP config chaining instructions for PS
2 parents aa57f14 + af615b1 commit 46ab572

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

articles/load-balancer/tutorial-gateway-powershell.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ New-AzLoadBalancer @lb
236236
## Add network virtual appliances to the Gateway Load Balancer backend pool
237237
Deploy NVAs through the Azure Marketplace. Once deployed, add the virtual machines to the backend pool with [Add-AzVMNetworkInterface](/powershell/module/az.compute/add-azvmnetworkinterface)
238238

239-
## Chain load balancer frontend to gateway load balancer
239+
## Chain load balancer frontend to Gateway Load Balancer
240240

241241
In this example, you'll chain the frontend of a standard load balancer to the gateway load balancer.
242242

@@ -279,6 +279,41 @@ $config | Set-AzLoadBalancer
279279
280280
```
281281

282+
## Chain virtual machine to Gateway Load Balancer
283+
284+
Alternatively, you can chain a VM's NIC IP configuration to the gateway load balancer.
285+
286+
You'll add the gateway load balancer's frontend to an existing VM's NIC IP configuration.
287+
288+
Use [Set-AzNetworkInterfaceIpConfig](/powershell/module/az.network/set-aznetworkinterfaceipconfig) to chain the gateway load balancer frontend to your existing VM's NIC IP configuration.
289+
290+
```azurepowershell-interactive
291+
## Place the gateway load balancer configuration into a variable. ##
292+
$par1 = @{
293+
ResourceGroupName = 'TutorGwLB-rg'
294+
Name = 'myLoadBalancer-gw'
295+
}
296+
$gwlb = Get-AzLoadBalancer @par1
297+
298+
## Place the existing NIC into a variable. ##
299+
$par2 = @{
300+
ResourceGroupName = 'MyResourceGroup'
301+
Name = 'myNic'
302+
}
303+
$nic = Get-AzNetworkInterface @par2
304+
305+
## Chain the gateway load balancer to your existing VM NIC. ##
306+
$par3 = @{
307+
Name = 'myIPconfig'
308+
NetworkInterface = $nic
309+
GatewayLoadBalancerId = $gwlb.FrontendIpConfigurations.Id
310+
}
311+
$config = Set-AzNetworkInterfaceIpConfig @par3
312+
313+
$config | Set-AzNetworkInterface
314+
315+
```
316+
282317
## Clean up resources
283318

284319
When no longer needed, you can use the [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) command to remove the resource group, load balancer, and the remaining resources.

0 commit comments

Comments
 (0)