Associate Azure Public IP to VM on-prem for RDP

Riza Marhaban 20 Reputation points
2024-09-05T07:12:54.8366667+00:00

I have established a Site-to-Site VPN connection from Azure to On-Prem VM. The server is connected, and I can access or ping from other Azure VM within the same VNET. Now, I wanted to add a new Public IP on Azure, and I would like to associate this public IP to the on-prem VM. Similar like if we create a VM on Azure, we can associate a public IP to it so we can RDP to the Azure VM. This time I would like to RDP to the on-prem VM through Azure Public IP. As the on-prem VM is connected to Azure via site-to-site VPN, technically this can be done. Right? But, how can I do that? Please don't advise me to use Bastion or whatever way, I know that. What I need is a Public IP for RDP to the on-prem VM via Azure.

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,514 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,402 questions
Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,504 questions
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 44,311 Reputation points Microsoft Employee
    2024-09-06T06:48:37.58+00:00

    @Riza Marhaban ,

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

    As per your observation, there is no out of the box service available in Azure as of today, to support this.

    The possible solution is that you can use a NVA (Such as Azure Firewall) and NAT the traffic to your OnPrem server

    • Deploy an Azure Firewall on the Azure VNET which contains the VPN Gateway
    • Note that Azure Firewall comes with it's own Public IP
    • Azure Firewall also supports DNAT
    • Let's say the Azure Firewall's Public IP is A.A.A.A and OnPrem server's private IP is B.B.B.B
    • Then you should create a DNAT Rule such that
      • Protocol : TCP
      • Source type : IP address
      • Source : *
      • Destination Addresses : A.A.A.A (Azure Firewall's Public IP)
      • Destination ports : 3389
      • Translated Address : B.B.B.B (OnPrem server's private IP)
      • Translated port : 3389 (OnPrem server's RDP Port)

    This way, Azure Firewall is practically acting as Cloud NAT Device to your OnPrem server for RDP.

    You can also use other 3rd party NVAs after validating whether they support a similar NAT feature.

    Also see : Rule processing Logic in Firewall Policy

    P.S : I did a lab and I can confirm this is working. From the logs, you can see the traffic is allowed

    User's image

    Thanks,

    Kapil


    Please Accept an answer if correct.

    Original posters help the community find answers faster by identifying the correct answer.

    1 person found this answer helpful.

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.