Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | AADSTS50173: Conditional Access compliance token expired — device compliance status stale, re-authentication required. | Windows Event Viewer (System Log) | -> |
| Affected OS build range | Windows 11 23H2 | Microsoft Entra ID documentation | -> |
| Registry key involved | HKLM\Software\Microsoft\IntuneMAM | SCCM/Intune logs | -> |
| Relevant service endpoint URL | https://login.microsoftonline.com | Entra ID portal | -> |
| Log line signature | Microsoft-Windows-DirectoryServices-DirectoryService/Operational | Windows Event Viewer (Security Log) | -> |
Log Files to Check
C:\Windows\System32\winevt\Logs\System.evtxC:\ProgramData\Microsoft\Intune\LogFiles\amdevice.log
What This Error Actually Means
The error codeAADSTS50173 is raised by Microsoft Entra ID's Conditional Access service when a device's compliance status token has expired, rendering the device non-compliant until re-authentication. This token is a security artifact generated during device enrollment or compliance checks, and its expiration indicates that the device has not communicated with the Entra ID service within the configured compliance token lifetime. The error specifically points to a stale compliance status, meaning the device's last compliance check is no longer valid, and re-authentication is required to refresh the token. This error is typically observed in environments where Conditional Access policies enforce device compliance checks, such as requiring devices to be enrolled in Intune or meet specific security baselines. The error is logged in the Windows Event Viewer under the Microsoft-Windows-DirectoryServices-DirectoryService/Operational log, with Event IDs such as 4625 (failed login) or 4768 (Kerberos authentication ticket request). The root component responsible for this error is the IntuneMAM service, which manages device compliance tokens in conjunction with Entra ID.
Affected Versions and Scope
This error is specific to Windows 11 build23H2 (OS build 22621 or later) and occurs in tenants where Conditional Access policies are configured to enforce device compliance. The issue does not affect Windows 10 or earlier OS versions unless explicitly configured with similar policies. Tenants without Conditional Access policies or those using device-based authentication (e.g., certificate-based authentication) are unlikely to encounter this error. Additionally, devices enrolled in Intune with a compliance policy that includes a token lifetime shorter than the device's inactivity period are at risk. The error is not observed in environments where device compliance is managed via Azure AD join without Intune or where compliance tokens are manually refreshed via dsregcmd /reenroll. The registry key HKLM\Software\Microsoft\IntuneMAM is directly involved in storing compliance token metadata, and misconfigurations here can exacerbate the issue.
Where To Look First: Logs and Event IDs
The primary log to investigate isC:\Windows\System32\winevt\Logs\System.evtx, where the error AADSTS50173 is logged under the Microsoft-Windows-DirectoryServices-DirectoryService/Operational provider. Use the following PowerShell command to filter relevant events:
Get-WinEvent -LogName "Microsoft-Windows-DirectoryServices-DirectoryService/Operational" | Where-Object { $_.Message -match "AADSTS50173" }.
Event IDs 4625 (failed login due to compliance token expiration) and 4768 (Kerberos ticket request failure) often accompany this error. Additionally, check C:\ProgramData\Microsoft\Intune\LogFiles\amdevice.log for lines containing "Compliance token expired" or "Re-authentication required". Use the Get-Content cmdlet with a regex filter:
Get-Content -Path "C:\ProgramData\Microsoft\Intune\LogFiles\amdevice.log" | Select-String "Compliance token expired".
The registry key HKLM\Software\Microsoft\IntuneMAM should be inspected for outdated or missing compliance token timestamps using Get-ItemProperty.
Root Causes
Expired Compliance Token Due to Inactivity
The most common cause is the device not authenticating within the configured compliance token lifetime (default 7 days). This can be verified by checking theLastComplianceCheckTime registry value under HKLM\Software\Microsoft\IntuneMAM. If this timestamp is older than the token lifetime, re-authentication is required.
Misconfigured Conditional Access Policy
A policy may enforce compliance checks with a shorter token lifetime than allowed by Intune. For example, a policy requiring compliance checks every 3 days but Intune's token lifetime is set to 7 days. This mismatch can be identified by comparing the policy in the Entra ID portal (Entra admin center > Security > Conditional Access) with Intune's device compliance settings.
Network or Endpoint Communication Failure
If the device cannot reachhttps://login.microsoftonline.com due to network restrictions or proxy misconfigurations, compliance tokens cannot be renewed. This is often observed in environments with strict firewall rules blocking outbound traffic to Microsoft endpoints.
Fix Procedure
- Refresh the compliance token using
dsregcmd /reenrollto force re-authentication. - Update the registry key
HKLM\Software\Microsoft\IntuneMAMto reset the compliance timestamp:Set-ItemProperty -Path "HKLM:\Software\Microsoft\IntuneMAM" -Name "LastComplianceCheckTime" -Value (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ"). - Adjust the compliance token lifetime in Intune:
Set-MgDeviceManagementDeviceCompliancePolicy -Id "PolicyID" -ComplianceGracePeriodDays 14. - Deploy an OMA-URI configuration in Intune to enforce token renewal:
./Device/Vendor/MSFT/Intune/Compliance/TokenRenewalInterval 86400(sets interval to 1 day). - Verify endpoint connectivity to
https://login.microsoftonline.comusingTest-NetConnection.
Modifying the registry directly can break device enrollment. Always back up the registry before making changes.
Error Code Variants
| Error Code | Description | Distinguishing Factor |
|---|---|---|
AADSTS50173 | Compliance token expired | Logged in System.evtx with Event ID 4625 |
AADSTS50057 | Device not enrolled in Intune | Occurs during initial enrollment, not compliance checks |
AADSTS50059 | Conditional Access policy not satisfied | Triggered by missing device compliance, not token expiration |
Verification
After applying fixes, verify the compliance token is renewed by checking theLastComplianceCheckTime registry value. Use dsregcmd /status to confirm the device is compliant. In the Entra admin center (Entra admin center > Devices > All devices), ensure the device status is "Compliant". The amdevice.log should no longer contain "Compliance token expired" entries, and Event ID 4625 should resolve.
Prevention
To prevent recurrence, configure Intune's device compliance policies to align with Conditional Access requirements. Use theSet-MgDeviceManagementDeviceCompliancePolicy cmdlet to set appropriate grace periods. Additionally, deploy a baseline policy in Intune to enforce periodic compliance checks via OMA-URI:
./Device/Vendor/MSFT/Intune/Compliance/CheckInterval 86400.
Regularly audit Conditional Access policies in the Entra admin center (Entra admin center > Security > Conditional Access) to ensure alignment with device management configurations.
Use
Get-MgDeviceManagementManagedDevice -Filter "deviceEnrollmentType eq 'windowsAutoEnrollment'" to identify devices at risk of compliance token expiration.