Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Remote Desktop "Network Level Authentication (NLA), but your Windows domain controller cannot be contacted to perform NLA": find the cause

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

The Remote Desktop message in full reads: "The remote computer that you are trying to connect to require Network Level Authentication (NLA), but your Windows domain controller cannot be contacted to perform NLA. If you are an administrator on the remote computer, you can disable NLA by using the options on the Remote tab of the System Properties dialog box." The server wants to check your sign-in with a domain controller and cannot.

Microsoft's page for this message is written for Windows virtual machines in Azure and lists several causes. Test them by reading first. Turning NLA off lets you in, but Microsoft describes that as a workaround to reach the server and fix the cause.

What the error means

Microsoft's page gives the symptom as a server that shows the Welcome screen and an operating system that is running, while Remote Desktop Connection returns one of three messages. The NLA message is the second:

  • "An authentication error has occurred. The Local Security Authority cannot be contacted."
  • The NLA message quoted above.
  • "This computer can't connect to the remote computer. Try connecting again, if the problem continues, contact the owner of the remote computer or your network administrator."

The page says: "The VM cannot communicate with the domain controller (DC). This problem could prevent an RDP session from accessing a VM by using domain credentials. However, you would still be able to log on by using the Local Administrator credentials."

Microsoft's page names Windows VMs in Azure. It does not say whether the same checks apply to servers hosted elsewhere, and it gives no Windows version range.

Likely causes

Cause What you see How to confirm
Active Directory secure channel between the server and the DC is broken Local administrator signs in; domain accounts do not Test-ComputerSecureChannel -Verbose returns False
The server holds an old copy of its account password and the DC has a newer one Same as above Microsoft's page gives Reset-ComputerMachinePassword as its step for this situation and names no read-only test for it
The DC the server connects to is unhealthy Same as above Find the DC with set | find /i "LOGONSERVER" and test it from another machine on the same network
Domain credentials are switched off on the server Domain sign-ins refused even with a healthy channel disabledomaincreds equals 1
The server's encryption level is higher than the client's, or FIPS-only is enforced Fails for standalone servers MinEncryptionLevel or FIPSAlgorithmPolicy values
The TLS 1.0, 1.1 or 1.2 server protocols are disabled Fails; SCHANNEL errors in the guest OS logs reg query of the TLS 1.2 Enabled value (Microsoft's page runs the same query for 1.0 and 1.1)

Prove the cause before changing anything

Microsoft's page says to connect to the server remotely, with the serial console, remote CMD or remote PowerShell, because Remote Desktop is the thing that is blocked. All the commands in this section read only.

Find which DC the server is using:

set | find /i "LOGONSERVER"

Test the secure channel from an elevated PowerShell window. Microsoft's page says the command "returns True or False indicating whether the secure channel is alive":

Test-ComputerSecureChannel -verbose

Microsoft's cmdlet page says it works on domain member computers only: "When you run it on Domain Controllers, it returns false positive errors." A True result with a healthy DC means the cause is elsewhere in this list.

Check whether domain credentials are switched off:

REG query "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v disabledomaincreds

Microsoft's page says: "If the key is set to 1, this means that the server was set up not to allow domain credentials."

For a standalone server, check the encryption level and the TLS server protocols:

reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MinEncryptionLevel
reg query "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" /v Enabled

Microsoft's page reads the encryption value as: 4 (FIPS), 3 (128-bit encryption), or 2 ("Highest encryption possible, as dictated by the client"). For TLS, Microsoft's page runs the same query for TLS 1.0, 1.1 and 1.2 and says: "If the returned values are not all 1, this means that the protocol is disabled." The query above covers TLS 1.2 only.

Example (illustrative): at contoso.com.au the server rds01 in a hosted network shows the NLA message for every domain user. CONTOSO\admin1 fails, .\Administrator signs in. set | find /i "LOGONSERVER" returns \\DC01. Test-ComputerSecureChannel -Verbose returns False. disabledomaincreds is 0 and MinEncryptionLevel is 2, so the secure channel is the cause and the other two settings are not.

Fix

Before any change, take the disk snapshot Microsoft's page asks for. Its "Before you troubleshoot" section says to create a backup snapshot by following its "Snapshot a disk" steps, which are Azure disk steps. For a server hosted outside Azure, Microsoft's page names no equivalent, so use the restore point your hosting provider offers.

Create C:\Temp first if it does not exist; every saved file below goes there.

Cause: broken secure channel

Run this only when the test above returned False on a domain member that is not a domain controller. Before you repair it, run the read-only test again and keep its output:

Test-ComputerSecureChannel -verbose

Risk: the next command removes and then rebuilds the channel the NetLogon service established between this server and its domain. Microsoft's cmdlet page says the current user must be a member of the local Administrators group, and that by default the cmdlet uses the current user's credentials. Microsoft's cmdlet page says of the Credential parameter only that it "is designed for use in commands that use the Repair parameter". The local Administrator is the account that can sign in here, and without -Credential the cmdlet would run with that account's credentials, so the command below asks for a domain account. Microsoft's page does not say which domain account is enough. Domain sign-ins to this server depend on that channel while it is rebuilt, and Microsoft's pages say nothing about what happens if the DC cannot be reached during the rebuild.

Repair the channel, signed in as a local administrator and supplying a domain account when asked:

$cred = Get-Credential
Test-ComputerSecureChannel -Repair -Credential $cred

Microsoft's cmdlet page describes no way to undo the repair. The only return point is the disk snapshot you took first.

Microsoft's page lists further steps if this does not work: resetting the computer account password with Reset-ComputerMachinePassword, restarting the DC, and removing and rejoining the server to the domain with netdom through a Custom Script Extension. The rejoin scripts place a domain administrator's password in a command line.

Cause: domain credentials are switched off

Run this only when disabledomaincreds returned 1. Before you change it, export the key to a new file:

reg export "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" C:\Temp\lsa-before-domaincreds.reg

Microsoft's reg export page says the file must have a .reg extension.

Risk: the next command allows domain accounts to sign in to this server. Someone may have set the value to 1 on purpose, so ask first. The Lsa key holds other security settings, and the back-out below writes back every value in the saved file.

Set the value to 0:

REG add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v disabledomaincreds /t REG_DWORD /d 0 /f

Microsoft's page pairs this command with a restart in its list for turning NLA back on; the restart step is below.

To undo it, import the saved file, then restart as described under Restart below:

reg import C:\Temp\lsa-before-domaincreds.reg

Cause: encryption level (standalone server)

Run this only when MinEncryptionLevel returned 3. Before you change it, export the key to a new file:

reg export "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" C:\Temp\rdp-tcp-before-encryption.reg

Risk: the next command lowers the minimum encryption level Remote Desktop requires on this server from 3 (128-bit encryption) to 2, for every connection. The change takes effect after a restart, which disconnects every user.

Microsoft's command:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v MinEncryptionLevel /t REG_DWORD /d 2 /f

To undo it, import the saved file, then restart as described under Restart below:

reg import C:\Temp\rdp-tcp-before-encryption.reg

Microsoft's page prints its lines for changing the FIPS value, and for changing a MinEncryptionLevel of 4 to 2, as reg query commands, which only read.

Cause: TLS server protocol disabled

Run this only when the TLS 1.2 query returned a value other than 1. If the query reports that the value is missing, Microsoft's page does not say what that means, so do not run the command. Before you change it, export the key to a new file:

reg export "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2" C:\Temp\tls12-before.reg

Risk: the next command enables the TLS 1.2 server protocol for the whole server, not only Remote Desktop, because it sits in the SCHANNEL protocol settings. Microsoft's page lists TLS 1.0 and 1.1 commands as well; enabling the older two is a security decision for your own policy.

Microsoft's command for TLS 1.2:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server" /v Enabled /t REG_DWORD /d 1 /f

To undo it, import the saved file, then restart as described under Restart below:

reg import C:\Temp\tls12-before.reg

Temporary way in: turn NLA off

This is a way in, not a fix. It is for a server whose cause you cannot fix from outside. Microsoft's page also names a DisableNLA script in Run Command. Before you change it, record whether the UserAuthentication value exists and what it holds. This only reads; write down the result, or write down that the query reported the value missing:

reg query "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication

Then export the key to a new file:

reg export "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" C:\Temp\rdp-tcp-before-nla.reg

Risk: the next command turns off Network Level Authentication for every Remote Desktop connection to this server. Microsoft calls it a workaround "to connect to the VM and resolve the cause". Leave it off only as long as the fix takes.

Microsoft's command:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /t REG_DWORD /d 0

Microsoft's line has no /f; per Microsoft's reg add page, /f adds the entry "without prompting for confirmation", so when the value already exists the command can wait for an answer, which stalls a script or a Run Command.

To undo it, use the back-out that matches what the query found, then restart as described under Restart below.

If the value existed before, import the saved file:

reg import C:\Temp\rdp-tcp-before-nla.reg

If the query reported the value missing, importing the file cannot remove what the command added. Delete that one value instead. Microsoft's reg delete page says /v deletes a specific entry under the subkey and /f deletes without asking for confirmation:

reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp" /v UserAuthentication /f

Each saved file holds the whole RDP-Tcp key. If you made both the encryption and the NLA change, undo them in the reverse order, because importing the earlier file also reverses the later change.

Restart (after a registry change or its undo)

Disruptive step: the next action restarts the server, which disconnects every user and stops everything running on it. After the encryption change, Microsoft's page says: "Restart the VM so that the changes to the registry take effect." After turning NLA off it says "Then, restart the VM", and its list for turning NLA back on ends with restarting the VM. For the TLS change the page gives no restart instruction; restart only if you decide to. Choose a quiet time, then restart the server.

Confirm the fix

  • Run Test-ComputerSecureChannel -verbose again. Microsoft's cmdlet page shows a healthy result as True with the message "The secure channel between 'SERVER01' and 'net.fabrikam.com' is alive and working correctly."
  • Sign in with a domain account over Remote Desktop with NLA on.

What to watch afterwards

  • NLA stays on. Microsoft says to re-enable it once the cause is resolved; the saved file does that.
  • The health of the domain controller the server uses, from another machine on the same network.
  • Any policy that sets these values. If a value comes back, a policy is setting it.

Risks and limits

These commands have not been run or lab-tested.

Microsoft's page covers Azure VMs and its cmdlet page shows no date. It gives no Windows version range. The registry changes affect the whole server, and a snapshot is the only return point from a rebuilt secure channel.

Sources