Error Details
| Fact | Value | Source | Note |
|---|
| Exact error string | AADSTS50158: External security challenge not satisfied — Identity Protection or SSPR challenge required before token issuance. | Event Viewer logs (Windows Logs\Application) | -> |
| OS build range | 23H2 | System Information | -> Windows 11 specific. |
| Registry key involved | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Credential Providers\Kerberos | Registry Editor | -> Check for misconfigurations. |
| Relevant service/endpoint URL | https://login.microsoftonline.com | Network Logs | -> Ensure connectivity. |
| Log line signature | Microsoft-Windows-DirectoryServices-KerberosService/Operational | Event Viewer logs (Windows Logs\Application) | -> Look for error codes and timestamps. |
Log Files to Check
C:\Windows\System32\winevt\Logs\Application.evtxC:\ProgramData\EntraID\SignInLogs.log
What This Error Actually Means
The error
AADSTS50158 is raised by **Azure AD (Entra ID)** during the authentication process when a user or device fails to satisfy an external security challenge enforced by **Azure AD Identity Protection** or **Self-Service Password Reset (SSPR)** policies. The hex code
AADSTS prefixes all Azure AD authentication service errors, and the suffix
50158 specifically indicates that a **security challenge (e.g., risk-based conditional access, SSPR verification, or device compliance check)** was not completed before token issuance. This error typically occurs during Kerberos authentication attempts when the device or user account is flagged by Azure AD's risk detection systems, requiring additional verification steps that were not fulfilled.
The error originates from the **Kerberos authentication component** in Windows, which interacts with the
https://login.microsoftonline.com endpoint. When the Kerberos protocol attempts to validate credentials against Azure AD, the authentication service (AS) rejects the request due to an outstanding security challenge. This is logged in the
Microsoft-Windows-DirectoryServices-KerberosService/Operational event log with a corresponding Event ID.
---
Affected Versions and Scope
This error is observed in **Windows 11 23H2** (OS build 22000.2189 or later) when the device is **Azure AD joined** or **hybrid Azure AD joined** and enrolled in conditional access policies that enforce SSPR or risk-based authentication. It is not specific to a particular Entra ID tenant configuration but is triggered when:
- A user account is flagged as **high-risk** by Azure AD Identity Protection.
- A device is non-compliant with Intune device compliance policies.
- An SSPR challenge (e.g., app password, phone call, or security question) is required but not completed.
This error **does not occur** in:
- On-premises AD-only environments (no Azure AD integration).
- Windows 10 or earlier versions unless explicitly configured for Azure AD join.
- Scenarios where conditional access policies or SSPR are not enforced.
---
Where To Look First: Logs and Event IDs
The primary diagnostic artifacts are located in the following paths:
- **Event Viewer logs**:
Windows Logs > Application under the
Microsoft-Windows-DirectoryServices-KerberosService/Operational source. Look for **Event ID 4** (Kerberos authentication failure) with the error string
AADSTS50158.
- **Log files**:
C:\Windows\System32\winevt\Logs\Application.evtx (binary event log) and
C:\ProgramData\EntraID\SignInLogs.log (plaintext sign-in logs). Use
Get-WinEvent or
Get-Content to parse these.
Example log line to grep in
SignInLogs.log:
"error":"AADSTS50158","errorDescription":"External security challenge not satisfied — Identity Protection or SSPR challenge required before token issuance"
The registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Credential Providers\Kerberos may also contain Kerberos-specific configuration overrides affecting authentication behavior.
---
Root Causes
1. Unresolved Azure AD Identity Protection Risk
Azure AD flags the user or device as high-risk (e.g., sign-in from a suspicious IP). Conditional access policies enforce a challenge (e.g., SSPR or MFA) that was not completed. To identify: Check the **Risk Level** in the Entra admin center (
Security > Risk Users).
2. Expired or Unverified SSPR Challenge
The user account requires SSPR verification (e.g., app password or security question) due to a password reset. If the challenge is not completed during login, Kerberos authentication fails. Verify in
Entra admin center > Users > Password Reset.
3. Misconfigured Kerberos Registry Settings
Modifications to the
Credential Providers\Kerberos registry key (e.g., disabling constrained delegation or altering SPN handling) can break authentication workflows. Validate registry values like
DisableLastKnownGood or
MaxServiceTicketAge.
---
Fix Procedure
- **Resolve Identity Protection Risk**:
In the
Entra admin center > Security > Risk Users, review the user's risk level. If high-risk, dismiss the risk or enforce MFA/SSPR.
Get-MgSecurityRiskDetection -UserId "[email protected]"
- **Complete SSPR Challenge**:
Force the user to reset their password via SSPR (
Entra admin center > Users > Reset Password). Verify in SignInLogs.log for successful SSPR completion.
- **Adjust Kerberos Registry Settings**:
Navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Credential Providers\Kerberos. Ensure DisableLastKnownGood is set to 0.
Warning: Incorrect registry changes can prevent device enrollment. Always back up the registry before editing.
- **Update Conditional Access Policies**:
In the
Entra admin center > Security > Conditional Access, review policies requiring SSPR/MFA. Temporarily disable or refine scope to exclude affected users.
- **Push Fixes via Intune**:
Use an OMA-URI profile to enforce registry settings:
./Device/Vendor/MSFT/Registry/Machine/Software/Microsoft/Windows/CurrentVersion/Policies/System/CredentialProviders/Kerberos/DisableLastKnownGood
Apply via Intune admin center > Devices > Configuration Profiles > Create Profile.
---
Error Code Variants
| Error Code |
Description |
Distinguishing Factor |
AADSTS50158 |
External security challenge not satisfied |
Requires SSPR or Identity Protection action |
AADSTS50057 |
User account not found |
No prior authentication attempt; no challenge required |
AADSTS50058 |
Invalid credentials |
Failed password attempt; no challenge required |
---
Verification
After applying fixes:
1. Check
SignInLogs.log for absence of
AADSTS50158 and presence of
"status":"success" entries.
2. Run
Get-MgDeviceManagementManagedDevice -Filter "deviceEnrollmentType eq 'azureADJoined'" to confirm device compliance.
3. In the
Entra admin center > Audit Logs, verify that the user’s sign-in status shows
Success with no challenges pending.
Diagnostic Shortcut: Use dsregcmd /status to check device registration state. Look for AADJoin=Yes and HealthAttestation=Compliant.
---
Prevention
To prevent recurrence:
- **Enforce SSPR**: In
Entra admin center > Passwords > Self-Service Password Reset, ensure all users have registered at least two SSPR methods.
- **Optimize Conditional Access**: In
Intune admin center > Security > Conditional Access, scope policies to exclude low-risk users.
- **Baseline Registry Settings**: Deploy a group policy or Intune configuration profile to lock down the
Credential Providers\Kerberos registry key with recommended values.
Use
Get-AzADUser -UserPrincipalName "[email protected]" | Set-AzADUser -PasswordPolicies "EnforceSSPR" to enforce SSPR at the user level. Regularly audit
SignInLogs.log for recurring challenges using
Select-String -Path "C:\ProgramData\EntraID\SignInLogs.log" -Pattern "AADSTS50158".