How to check virtual network gateway connection state using PS?

Oleg Tserkovnyuk 671 Reputation points
2024-01-05T12:16:48.6233333+00:00

I am looking for a way to check the virtual network gateway connection state using PS.

Based on the MS article that should be pretty simple, using command:

Get-AzVirtualNetworkGatewayConnection -Name $ConnectionName -ResourceGroupName $RGName

However, this solution does not work. Command Get-AzVirtualNetworkGatewayConnection returns some connection information but does not return the state.

The field 'ConnectionStatus' is always blank. Tried on more than 10 tenants. Tried on connected and disconnected connections.

1d

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.
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
{count} votes

Answer accepted by question author
  1. KapilAnanth 49,851 Reputation points Moderator
    2024-01-05T17:12:44.9766667+00:00

    Hi @Oleg Tserkovnyuk

    I tried to reproduce your issue with Powershell in Azure Cloud Shell and I am not able to repo the issue.

    User's image

    As you can see, I am able to see the ConnectionStatus as "Unknown" and not blank.

    Cheers,

    Kapil


0 additional answers

Sort by: Most helpful

Your answer

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