Skip to content

Commit c21f1ca

Browse files
Merge pull request #270933 from wtnlee/fixcrosstenant
fixed cross tenant
2 parents f23d1ab + aeff32e commit c21f1ca

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,33 +119,36 @@ 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
129-
```azurepowershell-interactive
130-
Update-AzVHubRouteTable -ResourceGroupName "[resource group name]"-VirtualHubName [“Hub Name”] -Name "defaultRouteTable" -Route @($Route2)
131-
```
132-
133-
1. Update the route in the virtual network connection to specify the next hop as an IP address.
136+
```azurepowershell-interactive
137+
Update-AzVHubRouteTable -ResourceGroupName "[resource group name]"-VirtualHubName [“Hub Name”] -Name "defaultRouteTable" -Route @($routeTable.Routes)
138+
```
139+
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
138-
```azurepowershell-interactive
145+
```azurepowershell-interactive
139146
$newroute = New-AzStaticRoute -Name "[Route Name]" -AddressPrefix "[@("Destination prefix")]" -NextHopIpAddress "[Destination NVA IP address]"
140147
141-
$newroutingconfig = New-AzRoutingConfiguration -AssociatedRouteTable $hubVnetConnection.RoutingConfiguration.AssociatedRouteTable.id -Id $hubVnetConnection.RoutingConfiguration.PropagatedRouteTables.Ids[0].id -Label @("default") -StaticRoute @($newroute)
142-
143-
Update-AzVirtualHubVnetConnection -ResourceGroupName $rgname -VirtualHubName "[Hub Name]" -Name "[Virtual hub connection name]" -RoutingConfiguration $newroutingconfig
148+
$hubVNetConnection.RoutingConfiguration.VnetRoutes.StaticRoutes.add($newroute)
144149
145-
```
146-
147-
This update command removes the previous manual configuration route in your routing table.
148-
150+
Update-AzVirtualHubVnetConnection -ResourceGroupName $rgname -VirtualHubName "[Hub Name]" -Name "[Virtual hub connection name]" -RoutingConfiguration $hubVNetConnection.RoutingConfiguration
151+
```
149152
1. Verify that the static route is established to a next-hop IP address.
150153
151154
```azurepowershell-interactive

0 commit comments

Comments
 (0)