Skip to content

Remote Desktop (mstsc) over PKU2U: client and server prerequisites

When you open Remote Desktop to a Microsoft Entra joined PC with the classic Network Level Authentication, the authentication between the two machines is PKU2U, not Kerberos or NTLM. This page lists what Microsoft documents about that scenario, explains which credentials can reach PKU2U, and shows mstsc logging on over PKU2U between two workgroup machines without Microsoft Entra ID (Windows 11 24H2, build 26100). How PKU2U itself works is covered in PKU2U internals.

Two ways mstsc signs in to an Entra joined PC
  • Microsoft Entra authentication: the Use a web account to sign in to the remote computer option, or the RDP property enablerdsaadauth:i:1. The client gets a token from Entra ID and the remote PC validates it. PKU2U is not involved. The client needs no join of any kind, but it must be online, the name typed must be the device name known to Entra ID, and an IP address is not accepted.
  • Classic NLA, the default: CredSSP runs over TLS, and inside it SPNEGO. Between two Entra devices neither Kerberos nor NTLM can work, so Negotiate goes through NegoEx, and NegoEx picks PKU2U. This page covers that case.

With NLA, the steps are those of any CredSSP connection. First the TLS channel. Then SPNEGO / NegoEx / PKU2U, six tokens with three round trips. Then the TLS public key and the delegated credentials, encrypted with the PKU2U context (SpSealMessage / SpUnsealMessage). Then the session logon on the server with the delegated credentials.

Prerequisites documented by Microsoft (Entra joined target)
Client (runs mstsc)Server (remote PC)
Join stateEntra joined or hybrid joined (Windows 10 1607+), or Entra registered (Windows 10 2004+), same tenant as the server. B2B guests are not supported.Entra joined (or hybrid joined).
PKU2U policyNetwork security: Allow PKU2U authentication requests to this computer to use online identities = Enabled, on both machines (HKLM\SYSTEM\CurrentControlSet\Control\Lsa\pku2u\AllowOnlineID = 1; MDM: LocalPoliciesSecurityOptions/NetworkSecurity_AllowPKU2UAuthenticationRequests). Off by default on domain-joined machines; security baselines recommend turning it off. On Windows Server 2016/2019 used as a client, it must be enabled explicitly.
User nameuser@domain.com or AzureAD\user@domain.com. DOMAIN\user fails (“Remote machine is Microsoft Entra joined…”).The user in Remote Desktop Users: net localgroup "Remote Desktop Users" /add "AzureAD\user@domain.com". An Entra group added there is not honored with NLA.
CredentialsPassword, smart card, or Windows Hello for Business in certificate trust. Per-user MFA is not supported.Remote Desktop enabled, NLA recommended.
OtherRemote Credential Guard off.—

Sources: Microsoft Learn, Connect to remote Microsoft Entra joined device, and the Windows 365 / Azure Virtual Desktop troubleshooting pages (“The logon attempt failed” = PKU2U refused on one of the two ends).

Why those prerequisites: what each machine needs inside
  • Both ends need a certificate from the same identity provider. PKU2U is PKINIT with no KDC: the client signs an AS-REQ, the server signs the AS-REP. Every certificate has to map to an identity provider of certpoleng.dll, meaning its issuer has to be in the provider's trust store. For Entra the provider is AzureAD, its store is AAD Token Issuer, and the certificates are the device and user peer-to-peer certificates Entra issues. That is why both machines must belong to the same tenant.
  • The server's certificate is chosen by the name you type in mstsc. The acceptor runs as a machine identity, and certpoleng selects its certificate from the host part of the target (TERMSRV/<name> → <name>). A name the device's certificate does not carry gives no certificate, hence SEC_E_NO_CREDENTIALS.
  • The remote user becomes a Windows token through the identity provider: an Entra user for the AzureAD provider, a local account named after the certificate for the local provider (see below). Without a matching account, the cryptographic exchange succeeds and the last step fails with SEC_E_LOGON_DENIED.
  • AllowOnlineID is read on the accepting side, before a certificate is selected, for online identities.
Which mstsc credential reaches PKU2U, and how

CredSSP hands PKU2U either the credential the user typed or saved, or nothing at all when the session's own credentials are used. PKU2U treats the two cases differently:

What mstsc usesWhat PKU2U receivesHow PKU2U finds its certificate
A password typed or saved for TERMSRV/<name>supplied credential, SEC_WINNT_AUTH_DATA_TYPE_PASSWORDIntPstMapUserCredsToProvider: the user name has to be an online identity (Entra / Microsoft account), whose provider then issues the certificate. A local account fails (ERROR_NO_SUCH_LOGON_SESSION).
A smart card (PIN prompt, or the marshalled certificate saved for TERMSRV/<name>)supplied credential, SEC_WINNT_AUTH_DATA_TYPE_CERTSame online-identity mapping. With a card outside Entra the metadata step fails with SEC_E_NO_CREDENTIALS, and mstsc shows The logon attempt failed.
Windows Hello for Business (certificate trust)supplied credential, SEC_WINNT_AUTH_DATA_TYPE_NGCAccepted type, for Entra users.
No credential: the session's own credentials (single sign-on, Allow delegating default credentials)no supplied credentialPKU2U reads Credential Manager itself: a CRED_TYPE_DOMAIN_CERTIFICATE for the target (TERMSRV/<name>), then for the host name (<name>). The certificate is mapped to a provider by its issuer. This is the only path that works with a software certificate and no Entra ID (see below).

Outside Entra, a credential saved for TERMSRV/<name> gets in the way. CredSSP supplies it, and PKU2U stops looking in Credential Manager. The certificate must be saved under the bare host name, and mstsc must connect with the session's default credentials.

Reproduce it: mstsc over PKU2U without Entra ID (PowerShell)

Two Windows 11 machines in a workgroup, PKU2U-SRV and PKU2U-CLIENT. The scripts Pku2uServer.ps1 and Pku2uClient.ps1 are in Pku2uLab.zip and listed in full in PKU2U internals. They use the built-in local identity provider {6D0F37E4-4FAC-4E44-9C07-6B8343FE4953}.

Prerequisites
Server (PKU2U-SRV)Client (PKU2U-CLIENT)
WindowsWindows 11 24H2 (build 26100), workgroup: no domain, no Entra ID
Who runs the scripta local administrator, elevated PowerShellmachine settings: elevated PowerShell. Certificate and mstsc: normal (not elevated) PowerShell, in the account that connects, since CurrentUser\My and Credential Manager are per user
Process that authenticatesSYSTEM: the RDP listener and LSASS. PKU2U accepts only in a SYSTEM process, nothing to do heremstsc, in the user's session, with a plain local account
Trust (machine, once)the lab CA in LocalMachine\Local Cert Issuer, the local provider enabled (LoadParameters\{6D0F37E4-…}\Enabled = 1), then a restart
CertificateCN=PKU2U-SRV in LocalMachine\My: the name the client types, unrelated to the RDP TLS certificateCN=User in CurrentUser\My, saved in Credential Manager under PKU2U-SRV, nothing saved for TERMSRV/PKU2U-SRV
Accounta local account User on both machines, with the same password: PKU2U logs the certificate on as User, then CredSSP sends the client session's password to open the desktop
Remote Desktopenabled, with Network Level AuthenticationAllow delegating default credentials (and the NTLM-only variant) for TERMSRV/*, then a restart: CredSSP reads the policy at startup
Server: elevated window
.\Pku2uServer.ps1 -Step Ca -ServerName PKU2U-SRV -UserName User
.\Pku2uServer.ps1 -Step Machine
.\Pku2uServer.ps1 -Step Rdp
Restart-Computer
  • Ca: the lab CA, the certificate CN=PKU2U-SRV in LocalMachine\My, and the certificate of the account User in pku2u-lab\user.pfx.
  • Machine: the CA in LocalMachine\Local Cert Issuer, the local provider enabled.
  • Rdp: Remote Desktop on, with Network Level Authentication, and its firewall rules.
Client: elevated window, then a normal one

Copy the server's pku2u-lab folder next to the script. Elevated:

.\Pku2uClient.ps1 -Step Machine
.\Pku2uClient.ps1 -Step Rdp -ServerName PKU2U-SRV -ServerAddress 192.168.45.214
Restart-Computer

Then in a normal PowerShell window, as User:

.\Pku2uClient.ps1 -Step User  -ServerName PKU2U-SRV
.\Pku2uClient.ps1 -Step Mstsc -ServerName PKU2U-SRV
  • Rdp: the Allow delegating default credentials policy and its …with NTLM-only server authentication variant for TERMSRV/*, so that mstsc connects with the session's own credentials instead of asking for some. -ServerAddress adds the server to hosts.
  • User: the certificate of User in CurrentUser\My, saved in Credential Manager under the host name PKU2U-SRV (a Domain Certificate in cmdkey /list), and any credential saved for TERMSRV/PKU2U-SRV removed.
  • Mstsc: one throwaway PKU2U attempt, then mstsc /v:PKU2U-SRV. After a restart, the first mapping of a client certificate fails while certpoleng loads its providers; without that attempt, the first connection after a boot fails with 0x80004005 and the second one works.
Result

mstsc connects without any prompt. PKU2U authenticates both machines with their certificates: the client presents CN=User, the server CN=PKU2U-SRV. Then CredSSP sends the client session's credentials (the password of User), and the server opens the desktop session. mstsc shows no warning about the server's RDP certificate either, because the PKU2U exchange has already authenticated the server. With a smart card instead of the saved software certificate, the same pair stops at the first step with The logon attempt failed (see the table above).

Troubleshooting
SymptomLikely cause
The logon attempt failed right after the credential prompt, nothing reaches the serverThe client has no PKU2U certificate for that credential: SpQueryMetaData → SEC_E_NO_CREDENTIALS. Common reasons: a local account typed with a password or a smart card outside Entra, the PKU2U policy disabled on the client, a device not joined to the tenant.
Same message, the server is reachedThe server found no certificate for the typed name (FQDN against a short device name, or an IP address), the policy is disabled on the server, or the provider is not loaded.
Same message although the setup looks completeThe delegation policy was set without a restart of the client: CredSSP reads it at startup and keeps supplying explicit credentials until then.
An authentication error (0x80004005) on the first connection after a boot, then successThe identity-provider cache of certpoleng was still empty. One earlier PKU2U attempt (-Step Mstsc makes one) avoids it.
A warning about the server's RDP certificate (The identity of the remote computer cannot be verified)PKU2U failed and Negotiate fell back to NTLM, which does not authenticate the server. Seen with two certificates of the same CA in the server's LocalMachine\My (CN=PKU2U-SRV and another name): keep one.
Cryptography succeeds, then SEC_E_LOGON_DENIEDThe identity in the client certificate maps to no account on the server (local provider: no local account of that name).
mstsc falls back to NTLMNegoEx did not offer PKU2U: no usable PKU2U credential on the client, and NTLM allowed.
EIDAuthenticate handles Remote Desktop with smart cards outside a domain. Questions? Contact us.