Skip to content

Commit 9cdb7d2

Browse files
Merge pull request #287559 from halkazwini/er-vnet-ps
Add high resiliency connection
2 parents 401dcf0 + b138179 commit 9cdb7d2

File tree

1 file changed

+47
-4
lines changed

1 file changed

+47
-4
lines changed

articles/expressroute/expressroute-howto-linkvnet-arm.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ services: expressroute
55
author: duongau
66
ms.service: azure-expressroute
77
ms.topic: how-to
8-
ms.date: 07/23/2023
8+
ms.date: 09/30/2024
99
ms.author: duau
10-
ms.custom: devx-track-azurepowershell, template-tutorial
10+
ms.custom: devx-track-azurepowershell
1111
---
1212
# Connect a virtual network to an ExpressRoute circuit using Azure PowerShell
1313

@@ -48,15 +48,58 @@ This article helps you link virtual networks (VNets) to Azure ExpressRoute circu
4848

4949
[!INCLUDE [expressroute-cloudshell](../../includes/expressroute-cloudshell-powershell-about.md)]
5050

51-
## Connect a virtual network in the same subscription to a circuit
52-
You can connect a virtual network gateway to an ExpressRoute circuit by using the following cmdlet. Make sure that the virtual network gateway is created and is ready for linking before you run the cmdlet:
51+
## Connect a virtual network
52+
53+
# [**Maximum Resiliency**](#tab/maximum)
54+
55+
**Maximum resiliency** (Recommended): provides the highest level of resiliency to your virtual network. It provides two redundant connections from the virtual network gateway to two different ExpressRoute circuits in different ExpressRoute locations.
56+
57+
### Clone the script
58+
59+
To create maximum resiliency connections, clone the setup script from GitHub.
60+
61+
```azurepowershell-interactive
62+
# Clone the setup script from GitHub.
63+
git clone https://github.com/Azure-Samples/azure-docs-powershell-samples/
64+
# Change to the directory where the script is located.
65+
CD azure-docs-powershell-samples/expressroute/
66+
```
67+
68+
Run the **New-AzHighAvailabilityVirtualNetworkGatewayConnections.ps1** script to create high availability connections. The following example shows how to create two new connections to two ExpressRoute circuits.
69+
70+
```azurepowershell-interactive
71+
$SubscriptionId = Get-AzureSubscription -SubscriptionName "<SubscriptionName>"
72+
$circuit1 = Get-AzExpressRouteCircuit -Name "MyCircuit1" -ResourceGroupName "MyRG"
73+
$circuit2 = Get-AzExpressRouteCircuit -Name "MyCircuit2" -ResourceGroupName "MyRG"
74+
$gw = Get-AzVirtualNetworkGateway -Name "ExpressRouteGw" -ResourceGroupName "MyRG"
75+
76+
highAvailabilitySetup/New-AzHighAvailabilityVirtualNetworkGatewayConnections.ps1 -SubscriptionId $SubscriptionId -ResourceGroupName "MyRG" -Location "West EU" -Name1 "ERConnection1" -Name2 "ERConnection2" -Peer1 $circuit1.Peerings[0] -Peer2 $circuit2.Peerings[0] -RoutingWeight1 10 -RoutingWeight2 10 -VirtualNetworkGateway1 $gw
77+
```
78+
79+
If you want to create a new connection and use an existing one, you can use the following example. This example creates a new connection to a second ExpressRoute circuit and uses an existing connection to the first ExpressRoute circuit.
80+
81+
```azurepowershell-interactive
82+
$SubscriptionId = Get-AzureSubscription -SubscriptionName "<SubscriptionName>"
83+
$circuit1 = Get-AzExpressRouteCircuit -Name "MyCircuit1" -ResourceGroupName "MyRG"
84+
$gw = Get-AzVirtualNetworkGateway -Name "ExpressRouteGw" -ResourceGroupName "MyRG"
85+
$connection = Get-AzVirtualNetworkGatewayConnection -Name "ERConnection1" -ResourceGroupName "MyRG"
86+
87+
highAvailabilitySetup/New-AzHighAvailabilityVirtualNetworkGatewayConnections.ps1 -SubscriptionId $SubscriptionId -ResourceGroupName "MyRG" -Location "West EU" -Name2 "ERConnection2" -Peer2 $circuit1.Peerings[0] -RoutingWeight2 10 -VirtualNetworkGateway1 $gw -ExistingVirtualNetworkGatewayConnection $connection
88+
```
89+
90+
# [**Standard Resiliency**](#tab/standard)
91+
92+
**Standard resiliency**: provides a single redundant connection from the virtual network gateway to a single ExpressRoute circuit.
93+
You can connect a virtual network gateway to an ExpressRoute circuit using the **New-AzVirtualNetworkGatewayConnection** cmdlet. Make sure that the virtual network gateway is created and is ready for linking before you run the cmdlet.
5394

5495
```azurepowershell-interactive
5596
$circuit = Get-AzExpressRouteCircuit -Name "MyCircuit" -ResourceGroupName "MyRG"
5697
$gw = Get-AzVirtualNetworkGateway -Name "ExpressRouteGw" -ResourceGroupName "MyRG"
5798
$connection = New-AzVirtualNetworkGatewayConnection -Name "ERConnection" -ResourceGroupName "MyRG" -Location "East US" -VirtualNetworkGateway1 $gw -PeerId $circuit.Id -ConnectionType ExpressRoute
5899
```
59100

101+
---
102+
60103
## Connect a virtual network in a different subscription to a circuit
61104
You can share an ExpressRoute circuit across multiple subscriptions. The following figure shows a simple schematic of how sharing works for ExpressRoute circuits across multiple subscriptions.
62105

0 commit comments

Comments
 (0)