Edit

Share via


Too many admin sessions open error when you try to connect to an Azure Windows VM

Applies to: ✔️ Windows VMs

This article helps you troubleshoot the "too many admin sessions open" error when you try to connect to an Azure Windows virtual machine (VM).

Symptoms

When you try to connect to an Azure Windows VM by using Remote Desktop Protocol (RDP), you receive the following error message:

Too many admin sessions open.

However, you can connect to the VM by using an administrative RDP session (mstsc /admin).

Cause

The issue occurs if you have reached the maximum allowed number of concurrent RDP connections.

Resolution

Before you start troubleshooting, back up the OS disk. Then, follow these steps:

  1. Connect to the VM by using the Azure Serial Console, and then start a PowerShell session. If the Azure Serial Console doesn't work, connect to the VM by using remote PowerShell. For more information, see How to use remote tools to troubleshoot Azure VM issues.

  2. After you connect to the VM, run the following command to identify the current maximum connections setting for the RDP service:

    reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core" /v MaxConnections
    

    If the value doesn't exist, the service uses the default setting that allows an unlimited number of RDP connections.

    If the value exists, run the following command to set the MaxConnections value to 0 to allow unlimited RDP connections:

    reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TerminalServerGateway\Config\Core" /v MaxConnections /t REG_DWORD /d 0xffffffff /f 
    
  3. Restart the VM, and then try again to connect to the VM.

Contact us for help

If you have questions or need help, create a support request, or ask Azure community support. You can also submit product feedback to Azure feedback community.