Unable to RDP to VM: "Remote Desktop can't connect to the remote computer for one of these reasons"

kobulloc msft 45 Reputation points
2024-07-18T06:51:10.3033333+00:00

Note: Based on common issues that we have seen from customers and other sources, we are posting these questions to help the Azure community.


I have a VM that I've been using for a while but now I run into a Remote Desktop connection error when I attempt to connect to it:

Remote Desktop can't connect to the remote computer for one of these reasons

User's image

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,596 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. kobulloc-MSFT 26,131 Reputation points Microsoft Employee
    2024-07-18T06:52:07.42+00:00

    Note: Based on common issues that we have seen from customers and other sources, we are posting these questions to help the Azure community.


    A quick note about RDP and VM security:

    It is a best practice to avoid direct RDP access to VMs in your subscription. If you need direct RDP access for administration or troubleshooting, enable just-in-time access to limit the potential attack surface on the VM.

    The potential security problem with using these RDP and SSH over the internet is that attackers can use brute force techniques to gain access to Azure virtual machines. After the attackers gain access, they can use your VM as a launch point for compromising other machines on your virtual network or even attack networked devices outside Azure.

    RDP troubleshooting:

    You can use the RDP troubleshooting guide to determine the cause of the problem:

    https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/windows/troubleshoot-rdp-connection

    A common cause is an active firewall that is blocking port 3389 (sometimes even when you think that it is disabled).

    Check the status of RDP:

    Get-Service -Name "TermService" | Select-Object -Property Status

    Check the status of the firewall:

    Get-NetFirewallProfile | Select-Object -Property Name, Enabled

    Disable the firewall (note security warning above):

    Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False

    Additional reading:

    0 comments No comments