Frequent RDP disconnects with very short sessions and high perceived latency typically indicate an issue with the RDP listener configuration or RDP session policies on the Windows VMs.
Use the following approach on one affected VM first, then replicate if it resolves the issue.
- Take a backup and access the VM for repair
- Take a snapshot of the OS disk of an affected VM as a backup before making changes.
- If direct RDP is unstable, use the Azure Serial Console to get a CMD instance on the VM. If Serial Console is not available or usable, attach the OS disk to a recovery VM and repair it offline.
- Reset RDP configuration via Serial Console (online repair)
In the Serial Console CMD instance, run these commands to reset key RDP parameters:
- Lower the RDP security layer to native RDP encryption:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v SecurityLayer /t REG_DWORD /d 0 /f
- Lower the encryption level to minimum (helps with compatibility and can stabilize connections):
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v MinEncryptionLevel /t REG_DWORD /d 1 /f
- Force RDP to load user configuration from the local machine:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fQueryUserConfigFromLocalMachine /t REG_DWORD /d 1 /f
- Enable RDP keep-alive to prevent idle disconnects:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v KeepAliveTimeout /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveEnable /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveInterval /t REG_DWORD /d 1 /f
- Configure reconnect behavior so sessions automatically reconnect instead of dropping:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritReconnectSame /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fReconnectSame /t REG_DWORD /d 1 /f
REG ADD "HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v fDisableAutoReconnect /t REG_DWORD /d 0 /f
- Ensure session timeouts are not forcing quick disconnects:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritMaxSessionTime /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritMaxDisconnectionTime /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v MaxDisconnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v MaxConnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritMaxIdleTime /t REG_DWORD /d 1 /f
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v MaxIdleTime /t REG_DWORD /d 0 /f
- Ensure the maximum concurrent connections limit is not too low:
REG ADD "HKLM\SYSTEM\CurrentControlSet\control\Terminal Server\Winstations\RDP-Tcp" /v MaxInstanceCount /t REG_DWORD /d 4294967295 /f
- Restart the VM and test RDP again.
- If the VM cannot be repaired online (offline repair)
If Serial Console cannot be used, perform the same reset offline:
- Attach the OS disk of the affected VM to a healthy recovery VM.
- In Disk Management, ensure the attached disk is Online and note its drive letter.
- Back up the registry hives from
\Windows\System32\config on the attached disk.
- In Registry Editor on the recovery VM:
- Select
HKEY_LOCAL_MACHINE → File → Load Hive.
- Load
SYSTEM from the attached disk as BROKENSYSTEM.
- Load
SOFTWARE from the attached disk as BROKENSOFTWARE.
- In an elevated Command Prompt, run the equivalent commands against the BROKENSYSTEM/BROKENSOFTWARE hives, for example:
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v SecurityLayer /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v SecurityLayer /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v MinEncryptionLevel /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v MinEncryptionLevel /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v fQueryUserConfigFromLocalMachine /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v fQueryUserConfigFromLocalMachine /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v KeepAliveTimeout /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v KeepAliveTimeout /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveEnable /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v KeepAliveInterval /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritReconnectSame /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritReconnectSame /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v MaxDisconnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v MaxDisconnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v MaxConnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v MaxConnectionTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritMaxIdleTime /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v MaxIdleTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v fInheritMaxIdleTime /t REG_DWORD /d 1 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v MaxIdleTime /t REG_DWORD /d 0 /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet001\control\Terminal Server\Winstations\RDP-Tcp" /v MaxInstanceCount /t REG_DWORD /d ffffffff /f
REG ADD "HKLM\BROKENSYSTEM\ControlSet002\control\Terminal Server\Winstations\RDP-Tcp" /v MaxInstanceCount /t REG_DWORD /d ffffffff /f
- Unload the BROKENSYSTEM and BROKENSOFTWARE hives in Registry Editor.
- Detach the disk, reattach it to the original VM, start the VM, and test RDP.
- General RDP connectivity checks
If disconnects persist after fixing the RDP listener configuration, follow the broader RDP troubleshooting flow:
- Use Azure portal resource-specific diagnostics for the VM to run the RDP connectivity troubleshooter.
- Verify Network Security Group rules allow inbound TCP 3389 and that no higher-priority deny rules are blocking traffic.
- Check VM console logs and Boot Diagnostics for OS-level issues.
- Reset the NIC, check VM Resource Health, reset the VM password, restart, and if needed redeploy the VM.
These steps address common causes of intermittent RDP connectivity and frequent disconnects due to misconfigured RDP listener and session policies on Azure Windows VMs.
References: