How to establish an RDP connection to an Azure VM only when the VPN is connected?

Darshan-S 10 Reputation points
2023-12-07T16:21:04.97+00:00

Hello,

I have a Windows Server hosted on an Azure Virtual Machine and multiple users connect to it. I want to allow RDP access only when the VPN is connected. If VPN is not connected, then the RDP shouldn't connect at all. How can I accomplish this? I'm searching for steps from Azure experts to help solve this issue.

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,043 questions
Windows for business | Windows Client for IT Pros | User experience | Remote desktop services and terminal services
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 123.7K Reputation points MVP Volunteer Moderator
    2023-12-07T16:37:25.5533333+00:00

    Hi @Darshan-S ,

    to connect to an Azure VM via RDP over a VPN connection and not via Public IP from the internet you can do this this way:

    Do not associate an Public IP to the Azure VM or deny the access via RDP to the Azure VM in a Network Security Group (NSG) if an Public IP is required for the Azure VM

    Deploy an Azure VPN Gateway and configure Point-To-Site connection for individual users (Configure server settings for P2S VPN Gateway connections). Alternative you can connect from the same Azure VPN Gateway from a company network via Site-To-Site connection (Tutorial: Create a site-to-site VPN connection in the Azure portal).

    If the VPN connection is established you should be able to connect via RDP to the private IP of the Azure VM.


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten

    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.