Skip to content

Commit 43842cc

Browse files
committed
fixed cross tenant
1 parent 7d05964 commit 43842cc

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

articles/virtual-wan/cross-tenant-vnet.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -119,32 +119,37 @@ In the following steps, you'll use commands to add a static route to the virtual
119119
```azurepowershell-interactive
120120
$hubVnetConnection = Get-AzVirtualHubVnetConnection -Name "[HubconnectionName]" -ParentResourceName "[Hub Name]" -ResourceGroupName "[resource group name]"
121121
```
122-
1. Add a static route to the virtual hub's route table. (The next hop is a virtual network connection.)
122+
1. Add a static route to the virtual hub's route table with next hop Virtual Network Connection. Existing routes in the route table are preserved with the following sample script.
123123
124124
```azurepowershell-interactive
125+
$routeTable = Get-AzVHubRouteTable -ResourceGroupName "[Resource group name]" -VirtualHubName "[Virtual hub name]" -Name "defaultRouteTable"
125126
$Route2 = New-AzVHubRoute -Name "[Route Name]" -Destination “[@("Destination prefix")]” -DestinationType "CIDR" -NextHop $hubVnetConnection.Id -NextHopType "ResourceId"
127+
$routeTable.Routes.add($Route2)
126128
```
129+
1. Verify the route table has the new routes:
130+
```azurepowershell-interactive
131+
$routeTable.Routes
132+
```
133+
127134
1. Update the hub's current default route table:
128135
129136
```azurepowershell-interactive
130-
Update-AzVHubRouteTable -ResourceGroupName "[resource group name]"-VirtualHubName [“Hub Name”] -Name "defaultRouteTable" -Route @($Route2)
137+
Update-AzVHubRouteTable -ResourceGroupName "[resource group name]"-VirtualHubName [“Hub Name”] -Name "defaultRouteTable" -Route @($routeTable.Routes)
131138
```
132-
133-
1. Update the route in the virtual network connection to specify the next hop as an IP address.
139+
$hubV
140+
1. Update the route in the virtual network connection to specify the next hop as an IP address. This sample script adds a new route to the VNET connection (preserving any existing routes).
134141
135142
> [!NOTE]
136143
> The route name should be the same as the one you used when you added a static route earlier. Otherwise, you'll create two routes in the routing table: one without an IP address and one with an IP address.
137144
138145
```azurepowershell-interactive
139-
$newroute = New-AzStaticRoute -Name "[Route Name]" -AddressPrefix "[@("Destination prefix")]" -NextHopIpAddress "[Destination NVA IP address]"
140-
141-
$newroutingconfig = New-AzRoutingConfiguration -AssociatedRouteTable $hubVnetConnection.RoutingConfiguration.AssociatedRouteTable.id -Id $hubVnetConnection.RoutingConfiguration.PropagatedRouteTables.Ids[0].id -Label @("default") -StaticRoute @($newroute)
146+
$newroute = New-AzStaticRoute -Name "[Route Name]" -AddressPrefix "[@("Destination prefix")]" -NextHopIpAddress "[Destination NVA IP address]"
142147
143-
Update-AzVirtualHubVnetConnection -ResourceGroupName $rgname -VirtualHubName "[Hub Name]" -Name "[Virtual hub connection name]" -RoutingConfiguration $newroutingconfig
148+
$hubVNetConnection.RoutingConfiguration.VnetRoutes.StaticRoutes.add($newroute)
144149
150+
Update-AzVirtualHubVnetConnection -ResourceGroupName $rgname -VirtualHubName "[Hub Name]" -Name "[Virtual hub connection name]" -RoutingConfiguration $hubVNetConnection.RoutingConfiguration
145151
```
146152
147-
This update command removes the previous manual configuration route in your routing table.
148153
149154
1. Verify that the static route is established to a next-hop IP address.
150155

0 commit comments

Comments
 (0)