If we use multiple local network gateways and route desired traffic with BGP, we can assign specific weight to desired peer so the outbound connection is always preferred.

Listing all active VGWs’

az network vnet-gateway list -g ERF_RG

This returns nice formatted JSON data with all our VPN gateways. We can also request a table formatted data if we are not interested in key – value dictionary:

pawel@Azure:~$ az network vnet-gateway list -g ERF_RG --out table
Active EnableBgp EnablePrivateIpAddress GatewayType Location Name ProvisioningState ResourceGroup ResourceGuid VpnGatewayGeneration VpnType
-------- ----------- ------------------------ ------------- ---------- ------ ------------------- --------------- ------------------------------------ ---------------------- ----------
False True False Vpn uksouth ikev2 Succeeded ERF_RG e73ca91b-b070-4735-be68-794b69a06cff Generation1 RouteBased

Listing all configured connections for the virtual gateway

pawel@Azure:~$ az network vpn-connection list -g ERF_RG --out table

Command above, lists all connections along with current routing weight.

Changing BGP weight for specific connection

az network vpn-connection update -g ERF_RG -n erf_bgp1 --routing-weight 100

Once routing weight has been changed, make sure we clear bgp process on remote end so our settings are saved.

Leave a Comment

Your email address will not be published. Required fields are marked *