An Azure service that is used to provision Windows and Linux virtual machines.
Not able to connect to VM on RDP
Please need help connecting to VM. Lost access to VM after changing the IP address to static locally on the VM.
Azure Virtual Machines
-
Jilakara Hemalatha • 11,515 Reputation points • Microsoft External Staff • Moderator
2026-04-02T19:02:57.7966667+00:00 Hello Filemon,
Thank you for reaching out regarding the RDP connectivity issue with your Azure Virtual Machine.
This issue occurs when a static IP address is manually configured inside the guest operating system. In Azure, IP address management is handled at the Virtual Network (VNet) and Network Interface (NIC) level using DHCP.
When a static IP is set within the OS, it creates a mismatch with Azure’s network configuration, which results in loss of connectivity (including RDP), even though the VM may still appear as Running in the portal.
Please follow the below recovery options in order:
- Use Azure Serial Console (Recommended when RDP is unavailable)
- Navigate to: Azure Portal → VM → Help → Serial Console
- Log in using your VM credentials
- Check current network configuration:
netsh interface ip show config - Identify the correct network interface name (for example: Ethernet, Ethernet 2) and verify whether DHCP is disabled.
- If DHCP is disabled, revert to DHCP:
netsh interface ip set address name="<NIC Name>" source=dhcp
netsh interface ip set dns name="<NIC Name>" source=dhcp
Example: netsh interface ip set address name="Ethernet 2" source=dhcp- Verify the configuration again:
netsh interface ip show configEnsure that DHCP is enabled and the assigned IP matches the one shown in the Azure portal.
Restart the VM: shutdown /r /t 0
Please refer documentation for more details: Cannot remote desktop to Azure Virtual Machines because of static IP
- Use Azure Run Command:
- Navigate to: Azure Portal → VM → Operations → Run Command
- Select RunPowerShellScript and Execute the following commands:
Set-NetIPInterface -InterfaceAlias "Ethernet" -Dhcp Enabled Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ResetServerAddresses Restart-ComputerThis will revert the network configuration back to DHCP and restore alignment with Azure networking.
Reference: Run scripts in your Windows VM by using action Run Commands
3.Validate NIC Configuration in Azure
Another important step is to verify the network configuration directly in Azure. Please navigate to your Virtual Machine in the Azure Portal, go to the Networking section, and open the associated Network Interface (NIC). Under IP configurations, check how the private IP address is assigned.
The IP should either be set to Dynamic, or if a fixed IP is required, it should be configured as Static at the Azure level, not inside the operating system. If any changes are made, kindly restart the VM to ensure they take effect and then attempt the RDP connection again.
Reference: Configure IP addresses for an Azure network interface
Option 4: OS Disk Recovery (Last Resort)
If you’re still unable to regain access after trying the above steps, you may consider recovering the VM by working directly with its OS disk.
To do this, first stop (deallocate) the affected VM from the Azure Portal. Then detach its OS disk and attach it as a data disk to another healthy VM. From there, you can access the disk and correct the network configuration offline. Once the necessary changes are made, reattach the disk back to the original VM and start it again.
This method is typically used as a last resort when other recovery options are not successful.
Reference: Troubleshoot a Windows VM by attaching the OS disk to a repair VM through the Azure portal
To help us narrow down the issue, could you please confirm the following:
- Were you able to connect to the VM via RDP successfully before changing the IP to static inside the OS?
- What exact error message do you receive now when attempting to RDP (for example: timeout, network unreachable, authentication error)?
- Do you currently have access to the VM through Azure Run Command or Serial Console?
- Is the VM using a Public IP for RDP, or are you connecting via VPN or Azure Bastion?
- Can you confirm if the Network Security Group (NSG) allows inbound TCP port 3389 from your source IP?
- What IP address did you configure manually inside the VM, and does it match the private IP assigned to the NIC in Azure?
- What is the current private IP assignment in Azure (Dynamic or Static) for the VM NIC?
Once we have these details, we can better identify the root cause and guide you with the appropriate resolution steps.
Additionally, could you please check the private message and provide the necessary details. -
Jilakara Hemalatha • 11,515 Reputation points • Microsoft External Staff • Moderator
2026-04-06T01:04:29.1933333+00:00 Hello Filemon,
Just checking if above provided response was helpful! Please let me know if you have any queries.
-
Ace Jerraldven C. Enoc • 220 Reputation points2026-04-07T08:34:38.24+00:00 Hi Filemon,
Losing RDP access to a VM after changing its IP address to static locally inside the VM is a common issue. Here are some steps to help you regain access.
- Check Network Configuration Inside the VM:
- The static IP you set inside the VM might not be compatible with the Azure virtual network subnet or might conflict with other IPs.
- Azure VMs typically get their IP address from DHCP managed by Azure. Setting a static IP inside the VM can cause connectivity issues.
- Use Azure Portal to Reset Network Interface:
- Go to the Azure portal.
- Navigate to the VM's Networking settings.
- Check the IP configuration of the network interface (NIC).
- Ensure the IP assignment is set to Dynamic or set a static IP from the Azure portal that matches the subnet.
- You can also reset the NIC or assign a new IP address from the portal.
base on my experience you just need to wait for 5-6 mins the services will automatically go back if no IP conflict and the IP is is align with the network subnet.
I hope you find this helpful ♠
- Check Network Configuration Inside the VM:
-
Ace Jerraldven C. Enoc • 220 Reputation points2026-04-07T12:19:28.4366667+00:00 Hi Filemon,
Losing RDP access to a VM after changing its IP address to static locally inside the VM is a common issue. Here are some steps to help you regain access.
- Check Network Configuration Inside the VM:
- The static IP you set inside the VM might not be compatible with the Azure virtual network subnet or might conflict with other IPs.
- Azure VMs typically get their IP address from DHCP managed by Azure. Setting a static IP inside the VM can cause connectivity issues.
- Use Azure Portal to Reset Network Interface:
- Go to the Azure portal.
- Navigate to the VM's Networking settings.
- Check the IP configuration of the network interface (NIC).
- Ensure the IP assignment is set to Dynamic or set a static IP from the Azure portal that matches the subnet.
- You can also reset the NIC or assign a new IP address from the portal.
- Ensure the IP assignment is set to Dynamic or set a static IP from the Azure portal that matches the subnet.
- Check the IP configuration of the network interface (NIC).
- Navigate to the VM's Networking settings.
- Go to the Azure portal.
- The static IP you set inside the VM might not be compatible with the Azure virtual network subnet or might conflict with other IPs.
base on my experience you just need to wait for 5-6 mins the services will automatically go back if no IP conflict and the IP is is align with the network subnet.
I hope you find this helpful ♠
- Check Network Configuration Inside the VM:
Sign in to comment