This error usually means the VM has the Remote Desktop Session Host role enabled, but no usable Remote Desktop license server is available, the license server is not activated, the grace period has expired, or the CAL configuration is incorrect.
Use this recovery path:
- Connect with an administrative RDP session.
- Download the RDP file from the Azure portal, then connect with:
mstsc /v:<Server>[:<Port>] /admin- A documented workaround is also to run:
This disables licensing for that connection only.mstsc <File name>.RDP /admin - If administrative RDP still fails, use the Azure VM Serial Console.
- In the Azure portal, open Support & Troubleshooting > Serial console.
- Start a CMD channel, switch to it with:
ch -si 1- Sign in with a valid local or domain account for the VM.
- Check whether the Remote Desktop Session Host role is enabled.
In an elevated CMD window, run:
reg query "HKLM\SOFTWARE\Microsoft\ServerManager\ServicingStorage\ServerComponentCache\RDS-RD-Server" /v InstallState- If the value is
0, the role is disabled. - If enabled, check the licensing configuration:
reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core" /v LicensingMode reg query "HKLM\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" /v SpecifiedLicenseServers - If the value is
- Correct the licensing settings if needed.
- If
LicensingModeis not4(per user), set it to4:
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core" /v LicensingMode /t REG_DWORD /d 4- If
SpecifiedLicenseServersis missing or incorrect, set the correct license server:
reg add "HKLM\SYSTEM\CurrentControlSet\Services\TermService\Parameters\LicenseServers" /v SpecifiedLicenseServers /t REG_MULTI_SZ /d "<FQDN / IP License server>"- Restart the VM after registry changes.
- If
- If no license server is actually needed, remove the RDS Session Host role.
This is appropriate when no more than two concurrent administrative RDP sessions are needed. Removing the role returns the VM to the default two concurrent RDP connections.
dism /ONLINE /Disable-feature /FeatureName:Remote-Desktop-Services- If the VM also has the licensing role installed but unused:
Risk: removing roles changes remote access behavior. Use this only if the VM is not intended to function as an RDS host.dism /ONLINE /Disable-feature /FeatureName:Licensing - Verify the VM can reach the license server.
Test connectivity from the VM to the license server on port 135:
telnet <FQDN / IP License Server> 135 - If RDP still does not work, run the standard Azure VM RDP checks.
- Reset RDP configuration in the Azure portal: VM > Help > Reset password > Mode = Reset configuration only.
- Verify NSG rules allow inbound RDP on port 3389.
- Check boot diagnostics.
- Reset the NIC.
- Check Resource health.
- Restart or redeploy the VM if needed. Note: redeploy can cause ephemeral disk data loss and can change dynamic IP addresses.
- Ensure local or on-premises firewalls allow outbound TCP 3389.
If the VM only needs normal admin access, the fastest fix is usually to connect with /admin, then either correct the RDS licensing configuration or remove the Remote Desktop Session Host role.
References: