How to check virtual network gateway connection state using PS?

Oleg Tserkovnyuk 666 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.
1,634 questions
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.
2,622 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 48,576 Reputation points Microsoft Employee
    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 Answers by the question author, which helps users to know the answer solved the author's problem.