forked from fabferri/az-pattern
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrs0-fetch-routes.ps1
35 lines (29 loc) · 1.56 KB
/
rs0-fetch-routes.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# description: fetch the routes tables from the Azure Route Server
#
# $subscriptionName: Azure subscription name
# $rgName: name of the resource group
# $vrName: name of the Azure Route Server
# $peer1Name: name of the peering between the route server and csr1
# $peer2Name: name of the peering between the route server and csr2
#
#
$subscriptionName = "AzDev1"
$rgName = "rs03"
$vrName = "rs01"
$peer1Name = "bgpconn-nva1"
$peer2Name = "bgpconn-nva2"
$ctx = (Get-AzContext).Name
if ($ctx -ne "ExpressRouteLab") {
# select the Azure subscription
$subscr = Get-AzSubscription -SubscriptionName $subscriptionName
Set-AzContext -Subscription $subscr.Id -ErrorAction Stop
}
write-host "route advertised to csr1:" -ForegroundColor Yellow
Get-AzVirtualRouterPeerAdvertisedRoute -ResourceGroupName $rgName -VirtualRouterName $vrName -PeerName $peer1Name -WarningAction Ignore | ft
write-host "route learned from csr1:" -ForegroundColor Yellow
Get-AzVirtualRouterPeerLearnedRoute -ResourceGroupName $rgName -VirtualRouterName $vrName -PeerName $peer1Name -WarningAction Ignore | ft
write-host "-------------------------------------------------" -ForegroundColor Yellow
write-host "route advertised to csr2:" -ForegroundColor Yellow
Get-AzVirtualRouterPeerAdvertisedRoute -ResourceGroupName $rgName -VirtualRouterName $vrName -PeerName $peer2Name -WarningAction Ignore | ft
write-host "route learned from csr2:" -ForegroundColor Yellow
Get-AzVirtualRouterPeerLearnedRoute -ResourceGroupName $rgName -VirtualRouterName $vrName -PeerName $peer2Name -WarningAction Ignore | ft