Azure SDK for Python - list routes in BGP session

Mituś Wojciech 45 Reputation points
2023-03-13T11:33:13.1433333+00:00

Hello, is it possible to use Azure SDK for Python to list routes in BGP sessions established in Azure Virtual Network Gateway?

Thanks,

Wojtek

Azure VPN Gateway
Azure VPN Gateway
An Azure service that enables the connection of on-premises networks to Azure through site-to-site virtual private networks.
1,786 questions
{count} votes

Accepted answer
  1. GitaraniSharma-MSFT 50,021 Reputation points Microsoft Employee Moderator
    2023-03-13T13:33:54.3933333+00:00

    Hello @Mituś Wojciech ,

    Welcome to Microsoft Q&A Platform. Thank you for reaching out & hope you are doing well.

    I understand that you would like to know if it is possible to use Azure SDK for Python to list routes in BGP sessions established in Azure Virtual Network Gateway.

    It should be possible to use Azure SDK for Python to list routes in BGP sessions established in Azure Virtual Network Gateway.

    First, you'll need to authenticate and create a "NetworkManagementClient" object, which you can use to interact with Azure networking resources.

    Refer: https://learn.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2022_05_01.networkmanagementclient?view=azure-python

    Then to list the BGP routes learned by a virtual network gateway, you'll need to use the "begin_get_learned_routes" method of the "VirtualNetworkGatewayConnectionsOperations" class.

    Refer: https://learn.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2022_05_01.operations.virtualnetworkgatewaysoperations?view=azure-python

    https://learn.microsoft.com/en-us/python/api/azure-mgmt-network/azure.mgmt.network.v2022_05_01.operations.virtualnetworkgatewaysoperations?view=azure-python#azure-mgmt-network-v2022-05-01-operations-virtualnetworkgatewaysoperations-begin-get-learned-routes

    "begin_get_learned_routes" operation retrieves a list of routes the virtual network gateway has learned, including routes learned from BGP peers.

    You'll need to provide the resource group name and the name of the virtual network gateway to list its learned routes.

    Kindly let us know if the above helps or you need further assistance on this issue.


    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.