0
0
AzureHow-ToBeginner · 4 min read

How to RDP into Azure VM: Step-by-Step Guide

To RDP into an Azure VM, first ensure the VM is running and has a public IP with port 3389 open in its network security group. Then, use the Remote Desktop Connection app on your computer and connect using the VM's public IP address and your VM username and password.
📐

Syntax

To connect to an Azure VM using RDP, you need the following:

  • VM Public IP: The IP address assigned to your VM.
  • Port 3389: The default port for RDP must be open in the VM's network security group.
  • Username and Password: Credentials created when the VM was set up.
  • RDP Client: A Remote Desktop client application on your local machine.

The connection syntax in the RDP client is simply the VM's public IP address.

powershell
mstsc /v:<VM_Public_IP>
💻

Example

This example shows how to connect to an Azure Windows VM using the built-in Remote Desktop Connection app on Windows.

  1. Find your VM's public IP address in the Azure portal under the VM's overview.
  2. Ensure port 3389 is allowed in the VM's network security group inbound rules.
  3. Open the Remote Desktop Connection app (type mstsc in the Start menu).
  4. Enter the VM's public IP address and click Connect.
  5. When prompted, enter your VM username and password.
powershell
mstsc /v:52.170.12.34
Output
Remote Desktop window opens and connects to the VM at 52.170.12.34
⚠️

Common Pitfalls

Common mistakes when trying to RDP into an Azure VM include:

  • Port 3389 blocked: The network security group might not allow inbound traffic on port 3389.
  • VM not running: The VM must be in a running state to accept connections.
  • Wrong IP address: Using a private IP instead of the public IP will fail unless connected via VPN.
  • Incorrect credentials: Using the wrong username or password will prevent login.

Always verify these settings before attempting to connect.

powershell
REM Incorrect: Trying to connect without opening port 3389
mstsc /v:52.170.12.34

REM Correct: Open port 3389 in NSG, then connect
az network nsg rule create --resource-group MyResourceGroup --nsg-name MyNSG --name AllowRDP --protocol Tcp --direction Inbound --priority 1000 --source-address-prefixes '*' --source-port-ranges '*' --destination-port-ranges 3389 --access Allow
mstsc /v:52.170.12.34
📊

Quick Reference

StepActionDetails
1Get VM Public IPFind in Azure portal under VM overview
2Check NSG RulesAllow inbound TCP on port 3389
3Start RDP ClientUse Remote Desktop Connection (mstsc)
4ConnectEnter VM public IP and credentials
5TroubleshootVerify VM running and credentials

Key Takeaways

Ensure port 3389 is open in the VM's network security group for inbound traffic.
Use the VM's public IP address to connect via Remote Desktop client.
Verify the VM is running and you have correct username and password.
Use the built-in Remote Desktop Connection app (mstsc) on Windows.
Check network and firewall settings if connection fails.