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.
- 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
Negotiategoes 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.
| Client (runs mstsc) | Server (remote PC) | |
|---|---|---|
| Join state | Entra 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 policy | Network 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 name | user@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. |
| Credentials | Password, smart card, or Windows Hello for Business in certificate trust. Per-user MFA is not supported. | Remote Desktop enabled, NLA recommended. |
| Other | Remote 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).
- 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 isAzureAD, its store isAAD 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, henceSEC_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. AllowOnlineIDis read on the accepting side, before a certificate is selected, for online identities.
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 uses | What PKU2U receives | How PKU2U finds its certificate |
|---|---|---|
A password typed or saved for TERMSRV/<name> | supplied credential, SEC_WINNT_AUTH_DATA_TYPE_PASSWORD | IntPstMapUserCredsToProvider: 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_CERT | Same 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_NGC | Accepted type, for Entra users. |
| No credential: the session's own credentials (single sign-on, Allow delegating default credentials) | no supplied credential | PKU2U 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.
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) | |
|---|---|---|
| Windows | Windows 11 24H2 (build 26100), workgroup: no domain, no Entra ID | |
| Who runs the script | a local administrator, elevated PowerShell | machine 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 authenticates | SYSTEM: the RDP listener and LSASS. PKU2U accepts only in a SYSTEM process, nothing to do here | mstsc, 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 | |
| Certificate | CN=PKU2U-SRV in LocalMachine\My: the name the client types, unrelated to the RDP TLS certificate | CN=User in CurrentUser\My, saved in Credential Manager under PKU2U-SRV, nothing saved for TERMSRV/PKU2U-SRV |
| Account | a 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 Desktop | enabled, with Network Level Authentication | Allow 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-SRVinLocalMachine\My, and the certificate of the accountUserinpku2u-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.-ServerAddressadds the server tohosts. - User: the certificate of
UserinCurrentUser\My, saved in Credential Manager under the host namePKU2U-SRV(a Domain Certificate incmdkey /list), and any credential saved forTERMSRV/PKU2U-SRVremoved. - 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 with0x80004005and 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).
| Symptom | Likely cause |
|---|---|
| The logon attempt failed right after the credential prompt, nothing reaches the server | The 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 reached | The 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 complete | The 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 success | The 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_DENIED | The identity in the client certificate maps to no account on the server (local provider: no local account of that name). |
| mstsc falls back to NTLM | NegoEx did not offer PKU2U: no usable PKU2U credential on the client, and NTLM allowed. |