Security & identity

Fix Microsoft Entra hybrid join failures with dsregcmd /status

Read dsregcmd /status output to find out why a domain-joined Windows device won't hybrid join: error phase, client error codes, SCP, proxy, sync and devices stuck in Pending.

13 min read
On this page

To troubleshoot a Windows device that won't Microsoft Entra hybrid join, run dsregcmd /status from an elevated command prompt and read three things: DomainJoined and AzureAdJoined in Device State, then Error Phase and Client ErrorCode in Diagnostic Data. The error phase (pre-check, discover, auth or join) tells you where registration stopped, and the client error code maps to a specific cause such as an unreadable service connection point, a proxy blocking the SYSTEM account, a federation server problem, or a computer object that Microsoft Entra Connect hasn't synced yet.

Who this is for and what you will have at the end

This guide is for administrators running hybrid identity with Microsoft Entra Connect whose domain-joined Windows devices don't hybrid join, sit in Pending, or join but give users no single sign-on.

At the end you will be able to:

  • Run dsregcmd /status in the right context and know which sections to trust.
  • Map an error phase and client error code to its cause and fix.
  • Check the service connection point (SCP) and network path the device uses.
  • Confirm the result in the Microsoft Entra admin center and with Microsoft Graph PowerShell.
  • Recover devices stuck in Pending and re-register a device cleanly.

Hybrid join usually exists to support device-based Conditional Access; the policy side is covered in requiring compliant devices with Conditional Access.

How hybrid join works

  1. The device reads the SCP object from the configuration naming context of its Active Directory forest. The SCP holds two keywords, azureADId:<TenantID> and azureADName:<verified domain>. The verified domain decides whether the device follows the managed or federated registration flow.
  2. Registration runs in the SYSTEM context, triggered by a scheduled task. The task is under Task Scheduler Library > Microsoft > Windows > Workplace Join > Automatic-Device-Join.
  3. In managed domains (password hash sync or pass-through authentication), the device performs a sync join. The computer object must first be synced to Microsoft Entra ID by Microsoft Entra Connect, so a first attempt before sync fails by design.
  4. In federated domains, the device gets a token from the federation service through integrated Windows authentication to a WS-Trust endpoint. From Windows 10 1803, if that fails, Windows falls back to sync join unless the fallback is disabled.

dsregcmd /status reports the outcome of these steps. The combination of three values in Device State gives the join type:

AzureAdJoinedEnterpriseJoinedDomainJoinedDevice state
YESNONOMicrosoft Entra joined
NONOYESDomain joined
YESNOYESMicrosoft Entra hybrid joined
NOYESYESOn-premises DRS joined

Prerequisites

Confirm the environment first. Many "device" problems are configuration problems that affect every machine in an OU or site.

  • Microsoft Entra Connect version 1.1.819.0 or later, with Configure device options > Configure Microsoft Entra hybrid join completed for each forest.
  • Sync scope: the OUs that contain the computer objects are selected in Microsoft Entra Connect, and the default device attributes are not excluded from sync.
  • Device setting: users are allowed to register their devices with Microsoft Entra ID.
  • Network access from the SYSTEM context to:
    • https://enterpriseregistration.windows.net
    • https://login.microsoftonline.com
    • https://device.login.microsoftonline.com
    • https://autologon.microsoftazuread-sso.com (if you use seamless SSO)
    • Your federation service (federated domains only)
  • Proxy: if you need an outbound proxy, the computer account must be able to discover it (WPAD, or WinHTTP proxy settings from Windows 10 1709) and authenticate to it silently, because registration runs in machine context.
  • TLS inspection: exclude https://device.login.microsoftonline.com and https://enterpriseregistration.windows.net from break-and-inspect. Inspection interferes with client certificate authentication, device registration and device-based Conditional Access.
  • Federated domains: the AD FS WS-Trust endpoints /adfs/services/trust/2005/windowstransport and /adfs/services/trust/13/windowstransport (plus the usernamemixed and certificatemixed variants) enabled. The windowstransport endpoints must be intranet-facing only.
  • Admin roles: Hybrid Identity Administrator to configure Microsoft Entra Connect, Enterprise Administrator credentials for each forest so the wizard can create the SCP, and at least Cloud Device Administrator to view device state in the admin center.

Step 1: Run dsregcmd /status in the right context

The same command returns different information depending on who runs it.

# Elevated prompt: join diagnostics run as SYSTEM, KeySignTest can run
dsregcmd /status
 
# Normal prompt as the signed-in user: valid User State and SSO State (PRT)
dsregcmd /status
Run fromUse it forCaveat
Elevated promptPre-join diagnostics in SYSTEM context, KeySignTestWamDefaultSet can show an error
Normal prompt, signed-in userAzureAdPrt, NgcSet, WAM state, PRT diagnosticsDiagnostics run as the user, not as SYSTEM

The User Context line in Diagnostic Data shows SYSTEM, UN-ELEVATED User or ELEVATED User, so you can always tell which run you're looking at.

Step 2: Check the device state

Compare these fields with the expected values:

FieldExpectedIf not
DomainJoinedYESThe device isn't domain joined and can't hybrid join at all
AzureAdJoinedYESThe join hasn't finished; read Diagnostic Data
WorkplaceJoinedNOA work account was added before hybrid join completed; ignored from Windows 10 1607

If AzureAdJoined is YES, skip to Step 5. If it's NO, read Diagnostic Data.

Step 3: Read the diagnostic tests and error phase

On Windows 10 1803 and later, the pre-join diagnostics look like this:

+----------------------------------------------------------------------+
| Diagnostic Data                                                      |
+----------------------------------------------------------------------+
     Diagnostics Reference : www.microsoft.com/aadjerrors
              User Context : SYSTEM
      AD Connectivity Test : PASS
     AD Configuration Test : PASS
        DRS Discovery Test : FAIL [0x801c0021/0x80072ee2]
     DRS Connectivity Test : SKIPPED
    Token acquisition Test : SKIPPED
     Fallback to Sync-Join : ENABLED
 
     Previous Registration : 2019-01-31 09:23:30.000 UTC
               Error Phase : discover
          Client ErrorCode : 0x801c0021
+----------------------------------------------------------------------+

Each test lines up with a phase:

  • AD Connectivity Test checks the domain controller. Failures show up in the pre-check phase.
  • AD Configuration Test reads and validates the SCP. Failures usually produce 0x801c001d in the discover phase.
  • DRS Discovery Test fetches the registration endpoints and performs a user realm request. Failures appear in the discover phase. The value in brackets is the error and sub-error, here a generic discovery failure caused by a network timeout.
  • DRS Connectivity Test is a basic connectivity test to the registration service.
  • Token Acquisition Test gets a token from the federation service for federated tenants. Failures appear in the auth phase.

Below the tests, Error Phase, Client ErrorCode, Server ErrorCode, Server Message and Request Id describe the last failed attempt. Only failed attempts are logged. On Windows 10 versions earlier than 1803, find the same information in Event Viewer under Applications and Services Log > Microsoft > Windows > User Device Registration, events 304, 305 and 307.

Step 4: Fix the failure by phase

Pre-check phase

The device has no line of sight to a domain controller. It must be on the internal network, or on a VPN with network line of sight to an on-premises domain controller, when registration runs.

Discover phase

The device either can't read a valid SCP or can't reach the registration and realm discovery endpoints as SYSTEM. Check the SCP first. For a forest named fabrikam.com:

$scp = New-Object System.DirectoryServices.DirectoryEntry
$scp.Path = "LDAP://CN=62a0ff2e-97b9-4513-943f-0d221bd30080,CN=Device Registration Configuration,CN=Services,CN=Configuration,DC=fabrikam,DC=com"
$scp.Keywords

The output should list azureADName: with a verified domain and azureADId: with your tenant ID. In a multi-forest environment the SCP must exist in every forest that contains domain-joined computers.

Client error codeMeaningFix
0x801c001d DSREG_AUTOJOIN_ADCONFIG_READ_FAILEDSCP can't be readConfigure the SCP; if event ID 220 is present with error 1312 or 1317, troubleshoot AD replication
0x801c0021 DSREG_AUTOJOIN_DISC_FAILEDGeneric discovery failureRead the sub-error in the DRS Discovery Test line
0x801c001f DSREG_AUTOJOIN_DISC_WAIT_TIMEOUTDiscovery timed outMake https://enterpriseregistration.windows.net reachable as SYSTEM
0x801c003d DSREG_AUTOJOIN_USERREALM_DISCOVERY_FAILEDRealm discovery failedMake https://login.microsoftonline.com reachable as SYSTEM
0x801c003a DSREG_DISCOVERY_TENANT_NOT_FOUNDWrong tenant ID in SCP, or no active subscriptionCorrect the SCP tenant ID
0x80072efd / 0x80072ee2Can't connect / network timeoutOpen the required endpoints and fix the proxy path
0x80072f8f WININET_E_DECODING_FAILEDResponse couldn't be decodedStop the proxy modifying the response
0x8007000d E_INVALIDDATAJSON couldn't be parsed, often a proxy returning an HTML sign-in pageLet the SYSTEM context authenticate to the proxy silently

Auth phase (federated domains only)

The device couldn't get a token silently for the registration service from your federation service. Check the WS-Trust endpoints and the Metadata Exchange (MEX) response. Event ID 305 in the User Device Registration log carries the error and server error codes.

Client error codeMeaningFix
0xcaa90017 ERROR_ADAL_PROTOCOL_NOT_SUPPORTEDProtocol isn't WS-TrustThe identity provider must support WS-Trust
0xcaa9002c ERROR_ADAL_FAILED_TO_PARSE_XMLFederation service didn't return XMLMake the MEX endpoint return valid XML; check the proxy
0xcaa90023 ERROR_ADAL_COULDNOT_DISCOVER_USERNAME_PASSWORD_ENDPOINTNo username/password endpoint foundEnable WS-Trust endpoints and publish them in MEX
0xcaa82ee2 ERROR_ADAL_INTERNET_TIMEOUTNetwork timeoutReach login.microsoftonline.com and the identity provider as SYSTEM
0xcaa82f8f ERROR_ADAL_INTERNET_SECURE_FAILURETLS certificate couldn't be validatedCheck client time skew and retry
0xcaa20003 ERROR_ADAL_SERVER_ERROR_INVALID_GRANTSAML token not acceptedCheck the federation server settings and its logs

Join phase

The registration request reached the service but was rejected, or the TPM failed. The Registration Type line shows whether it was a sync or federated join.

Client error codeMeaningFix
0x801c03f2 DSREG_E_DIRECTORY_FAILUREDRS returned DirectoryErrorRead the server message (below)
0x801c0002 DSREG_E_DEVICE_AUTHENTICATION_ERRORDRS returned AuthenticationErrorRead the server error code
0x80090016 NTE_BAD_KEYSETTPM keyset missing (TPM cleared, or bad sysprep image)Don't clear the TPM; build images from machines that were never joined or registered
0x80290407 TPM_E_PCP_INTERNAL_ERRORGeneric TPM errorWindows 10 1809 and later complete the join without the TPM
0x80280036 TPM_E_NOTFIPSTPM in FIPS mode not supportedDisable the TPM or its FIPS mode
0x80090031 NTE_AUTHENTICATION_IGNOREDTPM locked outTransient; wait for the cool-down

The most common server messages for a sync join are:

  • "The device object by the given id isn't found." Expected until Microsoft Entra Connect syncs the computer object. Wait for a sync cycle; the next attempt succeeds. If it never does, check that the OU is in sync scope.
  • "AADSTS90002: Tenant UUID not found." The tenant ID in the SCP is wrong.
  • AuthenticationError mentioning verification of the target computer's SID. Usually sync hasn't finished yet.
  • "Your request is throttled temporarily. Please try after 300 seconds." Several requests in quick succession; wait and retry.

Step 5: Check post-join health and the PRT

A device can be joined and still give users no single sign-on. In the elevated output, check:

  • DeviceAuthStatus in Device Details: SUCCESS means the device is present and enabled in Microsoft Entra ID. FAILED. Device is either disabled or deleted means exactly that.
  • KeySignTest: PASSED means the device keys are healthy. A failure usually marks the device for recovery, which is silent for hybrid joined devices at the next sign-in.
  • AadRecoveryEnabled: YES means the stored keys aren't usable and the next sign-in triggers recovery.

Then, as the signed-in user, check SSO State. AzureAdPrt : NO means the Primary Refresh Token couldn't be acquired. If AzureAdPrtUpdateTime is more than four hours old, lock and unlock the device and check whether it updates. From Windows 10 21H1 the output includes Attempt Status, Server Error Code and Server Error Description for the last failed attempt.

ErrorCauseFix
AADSTS50155 Device authentication failedDevice deleted or disabled in Microsoft Entra IDRe-enable it, or re-register with dsregcmd /debug /leave
AADSTS50126 invalid username or passwordWrong credentials, or a new password not yet synced by password hash syncWait for password sync, then sign in again
AADSTS50034 user account does not existUPN not synced, or a SAM account name sent instead of a UPNCheck sync scope and that whoami /upn returns a routable UPN
0xc000005f STATUS_NO_SUCH_LOGON_SESSIONUPN suffix isn't a verified domainAdd the domain, or configure an alternate login ID for non-routable suffixes
0xc004844c USERNAME_IS_MALFORMEDUPN format is wrongFix the UPN returned by the domain controller

Remember that a hybrid joined device disabled in Microsoft Entra ID is re-enabled at the next sync cycle if the computer account is enabled on-premises. Disable it in Active Directory instead.

Verify the join in Microsoft Entra ID

In the Microsoft Entra admin center, browse to Entra ID > Devices > All devices and search for the device. If the Registered column shows Pending, hybrid join hasn't completed. A date and time means it has.

With Microsoft Graph PowerShell, look the device up by the DeviceId from dsregcmd /status:

Connect-MgGraph -Scopes "Device.Read.All"
 
$id = "00aa00aa-bb11-cc22-dd33-44ee44ee44ee"   # DeviceId from dsregcmd /status
Get-MgDevice -Filter "deviceId eq '$id'" |
    Select-Object DisplayName, DeviceId, TrustType, AccountEnabled, ApproximateLastSignInDateTime

TrustType should be ServerAd (on-premises domain joined devices joined to Microsoft Entra ID) and AccountEnabled should be True. Note that -DeviceId on Get-MgDevice takes the object ID, not the device ID, which is why the example uses a filter.

Recover devices stuck in Pending

Pending devices exist only for hybrid join. Microsoft Entra Connect creates the device object and sets it to Pending until the device registers. Two scenarios leave it stuck:

  1. The device never completes registration, usually because of the network or SCP problems in Step 4.
  2. The object left sync scope and came back. Moving a computer to an OU that isn't synced makes Microsoft Entra Connect delete the device in Microsoft Entra ID. Moving it back creates a new Pending object, and the device, which considers itself already registered, never completes registration.

For the second case, unregister and let the scheduled task re-register:

# Elevated prompt on the affected device
dsregcmd.exe /debug /leave
# Then restart, or sign out and sign in, to trigger Automatic-Device-Join

To count Pending devices across the tenant:

(Get-MgDevice -All -Filter "TrustType eq 'ServerAd'" |
    Where-Object { -not $_.AlternativeSecurityIds }).Count

Collect logs when the cause isn't clear

  • User Device Registration event log: 304, 305 and 307 for join failures, 201 for discovery sub-errors, 204 for join phase errors.
  • AAD operational and analytic logs (Applications and Services Log > Microsoft > Windows > AAD): events 1006 and 1007 bracket PRT acquisition, and 1007 logs the final error code.

Checklist

  • Microsoft Entra Connect device options configured; computer OUs in sync scope; default device attributes synced.
  • SCP present in every forest with the right azureADId and a verified azureADName.
  • Registration and login endpoints reachable as SYSTEM, through a proxy the computer account can authenticate to, without TLS inspection.
  • For federated domains, WS-Trust endpoints enabled and published in MEX; windowstransport intranet-only.
  • dsregcmd /status shows DomainJoined : YES and AzureAdJoined : YES, DeviceAuthStatus : SUCCESS, and AzureAdPrt : YES for the signed-in user.
  • Device shows a registration date in All devices, not Pending, with TrustType ServerAd.
  • Pending devices recovered with dsregcmd /debug /leave and a restart.

References

Questions people ask

Why does a hybrid joined device show Pending in Microsoft Entra ID?

Pending means Microsoft Entra Connect synced the computer object but the device never completed registration with the device registration service. A Pending device can't get a Primary Refresh Token or satisfy device-based Conditional Access. The usual causes are a device that can't reach the registration endpoints, or a computer object that was moved out of sync scope and back, which is fixed with dsregcmd /leave and a restart.

Should I run dsregcmd /status elevated or as the signed-in user?

Run it both ways. From an elevated prompt the join diagnostics run in SYSTEM context, which is closest to the real join, and the KeySignTest can run. From a normal prompt as the signed-in user you get a valid User State and SSO State, including whether the user has a Primary Refresh Token.

What does error 0x801c03f2 mean during hybrid join?

It is DSREG_E_DIRECTORY_FAILURE, an error response from the device registration service with ErrorCode DirectoryError. With a sync join and the server message saying the device object isn't found, it is expected: the computer object hasn't synced to Microsoft Entra ID yet. The next join attempt after Microsoft Entra Connect finishes a sync cycle resolves it.

How do I force a hybrid joined Windows device to register again?

Open an elevated command prompt, run dsregcmd.exe /debug /leave, then sign out and sign in or restart. The Automatic-Device-Join scheduled task under Microsoft, Windows, Workplace Join registers the device again, provided the SCP, network access and sync scope are correct.

Microsoft Entra IDHybrid joinWindowsEntra Connect
  1. Conditional Access token protection: stop stolen token replay

    Bind Microsoft 365 sign-in sessions to the device with Conditional Access token protection: supported apps, report-only rollout, sign-in log status codes, KQL and exclusions.

  2. Entra SSPR with password writeback: setup and the registered-methods change

    Set up Microsoft Entra self-service password reset with writeback to Active Directory through Entra Connect or Cloud Sync, and get users ready for SSPR accepting only registered methods.

  3. Fix Entra Connect AttributeValueMustBeUnique and duplicate proxy addresses

    Find which object already holds the duplicated proxyAddresses or userPrincipalName value, remove it from the right side, and confirm the next Entra Connect sync exports cleanly.