Auto Disconnect P2S VPN Connections

Trent Becker 71 Reputation points
2024-08-29T14:42:49.0533333+00:00

Hello,

I am trying to setup the ability to disconnect users on an Azure VWan, Hub, P2S session. This can be manually done by going to the Point to Site Sessions page and manually disconnecting it. However, this is not ideal for trying to disconnect users after 24 hours. I wanted to automate this using the Disconnect-AzVirtualNetworkGatewayVpnConnection powershell command. However, that only works on Network Gateways and does not appear to support P2S gateways inside of an Azure Virtual Hub. Is there a way to disconnect users after 24 hours of being connected to a session whether it be through powershell or some configuration settings?

Azure Virtual WAN
Azure Virtual WAN
An Azure virtual networking service that provides optimized and automated branch-to-branch connectivity.
226 questions
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,557 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,593 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 46,876 Reputation points Microsoft Employee
    2024-08-30T12:07:05.33+00:00

    @Trent Becker ,

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

    I understand that you would like to know the equivalent of Disconnect-AzVirtualNetworkGatewayVpnConnection for Azure vWAN P2S Gateway.

    You can use this : Disconnect-AzP2SVpnGatewayVpnConnection

    • The syntax is similar to regular VPN Gateway's P2S.

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

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Sina Salam 12,011 Reputation points
    2024-08-29T22:28:31.39+00:00

    Hello Trent Becker,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    Regarding your question on how you can automate the disconnection of users after 24 hours on an Azure VWan Hub P2S session, have you tried a combination of Azure Functions and PowerShell? That will be a best way to handle this. Check through this links and for more steps on how you can use Azure Functions and PowerShell to achieve your goal: https://learn.microsoft.com/en-us/azure/vpn-gateway/p2s-session-management and https://learn.microsoft.com/en-us/azure/virtual-wan/monitor-point-to-site-connections

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam

    0 comments No comments

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.