View BGP metrics and status
You can view BGP metrics and status by using the Azure portal, or by using Azure PowerShell.
Azure portal
In the Azure portal, you can view BGP peers, learned routes, and advertised routes. You can also download .csv files containing this data.
In the Azure portal, navigate to your virtual network gateway.
Under Monitoring, select BGP peers to open the BGP peers page.
Learned routes
You can view up to 50 learned routes in the portal.
You can also download the learned routes file. If you have more than 50 learned routes, the only way to view all of them is by downloading and viewing the .csv file. To download, select Download learned routes.
Then, view the file.
Advertised routes
To view advertised routes, select the ... at the end of the network that you want to view, then click View advertised routes.
On the Routes advertised to peer page, you can view up to 50 advertised routes.
You can also download the advertised routes file. If you have more than 50 advertised routes, the only way to view all of them is by downloading and viewing the .csv file. To download, select Download advertised routes.
Then, view the file.
BGP peers
You can view up to 50 BGP peers in the portal.
You can also download the BGP peers file. If you have more than 50 BGP peers, the only way to view all of them is by downloading and viewing the .csv file. To download, select Download BGP peers on the portal page.
Then, view the file.
PowerShell
Use Get-AzVirtualNetworkGatewayBGPPeerStatus to view all BGP peers and the status.
This article uses PowerShell cmdlets. To run the cmdlets, you can use Azure Cloud Shell. Cloud Shell is a free interactive shell that you can use to run the steps in this article. It has common Azure tools preinstalled and configured to use with your account.
To open Cloud Shell, just select Open Cloudshell from the upper-right corner of a code block. You can also open Cloud Shell on a separate browser tab by going to https://shell.azure.com/powershell. Select Copy to copy the blocks of code, paste them into Cloud Shell, and select the Enter key to run them.
You can also install and run the Azure PowerShell cmdlets locally on your computer. PowerShell cmdlets are updated frequently. If you haven't installed the latest version, the values specified in the instructions may fail. To find the versions of Azure PowerShell installed on your computer, use the Get-Module -ListAvailable Az
cmdlet. To install or update, see Install the Azure PowerShell module.
Get-AzVirtualNetworkGatewayBgpPeerStatus -ResourceGroupName resourceGroup -VirtualNetworkGatewayName gatewayName
Asn : 65515
ConnectedDuration : 9.01:04:53.5768637
LocalAddress : 10.1.0.254
MessagesReceived : 14893
MessagesSent : 14900
Neighbor : 10.0.0.254
RoutesReceived : 1
State : Connected
Use Get-AzVirtualNetworkGatewayLearnedRoute to view all the routes that the gateway has learnt through BGP.
Get-AzVirtualNetworkGatewayLearnedRoute -ResourceGroupName resourceGroup -VirtualNetworkGatewayname gatewayName
AsPath :
LocalAddress : 10.1.0.254
Network : 10.1.0.0/16
NextHop :
Origin : Network
SourcePeer : 10.1.0.254
Weight : 32768
AsPath :
LocalAddress : 10.1.0.254
Network : 10.0.0.254/32
NextHop :
Origin : Network
SourcePeer : 10.1.0.254
Weight : 32768
AsPath : 65515
LocalAddress : 10.1.0.254
Network : 10.0.0.0/16
NextHop : 10.0.0.254
Origin : EBgp
SourcePeer : 10.0.0.254
Weight : 32768
Use Get-AzVirtualNetworkGatewayAdvertisedRoute to view all the routes that the gateway is advertising to its peers through BGP.
Get-AzVirtualNetworkGatewayAdvertisedRoute -VirtualNetworkGatewayName gatewayName -ResourceGroupName resourceGroupName -Peer 10.0.0.254
Rest API
You can also use the GetBgpPeerStatus Rest API call to retrieve the information. This is an Async operation and will return a 202 status code. You need to fetch the results via a separate GET call. For more information, see Azure-AsyncOperation request and response.
Next steps
For more information about BGP, see Configure BGP for VPN Gateway.
Feedback
Submit and view feedback for