Share via

How to disconnect virtual network gateway connection

Subir Saha 0 Reputation points
2023-04-11T15:31:30.58+00:00

Hello, I am trying to disconnect virtual network gateway connection but getting below error: Vpn client addresspool is not specified for gateway Command i am using is below: Disconnect-AzVirtualNetworkGatewayVpnConnection -ResourceName xyz -ResourceGroupName abc -VpnConnectionId @("rgh89f-ddfr-abcg-951e-1ed145c688cd") I am not sure if i am putting the right VPn connection ID (please let me know if there is a way to get the connection id) Again i am only trying to disconnect and not delete the vpn connection.

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.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Krishna Puneeth Kammili 1 Reputation point
    2025-12-05T13:24:36.7333333+00:00

    This command is for P2S connections. I'm trying hard to find exact powershell command for S2S connections.

    Was this answer helpful?

    0 comments No comments

  2. Hakim 0 Reputation points
    2023-08-23T20:43:44.6966667+00:00

    Hello,

    Same issue as Subir Saha with the message

    "Vpn Client operation cannot be performed without a valid VpnClientConfiguration."

    Please share the your solution here

    Thanks!

    Was this answer helpful?

    0 comments No comments

  3. ChaitanyaNaykodi-MSFT 27,666 Reputation points Microsoft Employee Moderator
    2023-04-12T04:16:21.8933333+00:00

    @Subir Saha Thank you for reaching out to us. You can fetch the VpnConnectionId by running the command mentioned here

    Get-AzVirtualNetworkGatewayVpnClientConnectionHealth -VirtualNetworkGatewayName <name of the gateway>  -ResourceGroupName <name of the resource group>
    

    Copy the VpnConnectionId of the session that you want to disconnect.

    Disconnect-AzVirtualNetworkGatewayVpnConnection -VirtualNetworkGatewayName <name of the gateway> -ResourceGroupName <name of the resource group> -VpnConnectionId <VpnConnectionId of the session>
    
    

    You can try this via Portal if PowerShell command fails. Hope this helps! Please let me know if you are still facing the same issue. Thank you!

    Was this answer 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.