Error Details
| Fact | Value | Source | Note |
|---|
| Exact error string | The operation failed with error code 0x801C0399. | Windows Setup logs (Panther) | -> Indicates network/DNS failure during Azure AD join |
| Affected build range | Windows 11 23H2 | Microsoft documentation | -> Confirmed in recent builds of Windows 11 |
| Registry key involved | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE | Windows Registry | -> Contains OOBE configuration settings |
| Relevant service/endpoint URL | https://login.microsoftonline.com | Azure AD documentation | -> Azure AD authentication endpoint |
| Log line signature | [AzureADJoin] Error code: 0x801C0399 | Windows Setup logs (Panther) | -> Identifies the specific error in logs |
Log Files to Check
C:\Windows\Panther\SetupOOBE.logC:\Windows\Panther\SetupAct.log
What This Error Actually Means
The error code
0x801C0399 is a hexadecimal representation of a Windows authentication failure. Breaking it down:
0x801C indicates the error originates from the Windows authentication subsystem, while
0x0399 (decimal 921) corresponds to a specific failure in the Azure AD join process during Out-of-Box Experience (OOBE). This error is raised by the
Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider component, which handles device identity and enrollment workflows. The root issue is typically a failure to establish a secure connection to
https://login.microsoftonline.com, the Azure AD authentication endpoint. This failure is often masked by network or DNS misconfigurations, such as incorrect DNS server assignments, firewall rules blocking outbound HTTPS traffic to Microsoft endpoints, or proxy misconfigurations. The error is distinct from generic network errors because it explicitly ties to the Azure AD join phase, not earlier stages like device provisioning.
Affected Versions and Scope
This error is explicitly tied to
Windows 11 23H2 (build 22621 or later). Earlier builds, such as
Windows 11 22H2 (build 22000) or
Windows 10 21H2, are unaffected due to differences in the OOBE enrollment pipeline. The issue is most prevalent in tenants using Azure AD-joined Autopilot devices with no hybrid AD configuration. It does not occur in devices enrolled via hybrid Azure AD join or those using Intune-based enrollment without Azure AD join. The error is also exclusive to scenarios where the device is configured to join Azure AD during OOBE, as opposed to post-provisioning enrollment. Tenants with strict network segmentation or custom DNS policies are particularly vulnerable, as are environments where DNS resolution for
login.microsoftonline.com is not properly configured.
Where To Look First: Logs and Event IDs
The primary diagnostic artifacts are located in
C:\Windows\Panther\SetupOOBE.log and
C:\Windows\Panther\SetupAct.log. Use
Get-Content or
Get-WinEvent to search for the exact log line:
[AzureADJoin] Error code: 0x801C0399. Event Viewer logs under
Applications and Services Logs > Microsoft > Windows > DeviceManagement-Enterprise-Diagnostics-Provider > Admin will show
Event ID 1000 (device enrollment failure) and
Event ID 4103 (Azure AD join failure). To automate log analysis, run:
Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" -MaxEvents 50 | Where-Object Message -Match "0x801C0399"
Additionally, check the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE registry key for misconfigured
DisableEnterpriseOobe or
BypassOOBE values. Use
Get-DnsClientServerAddress to verify DNS server assignments and
Test-NetConnection to validate connectivity to
login.microsoftonline.com.
Root Causes
1. Network Connectivity or DNS Misconfiguration
The most common cause is a failure to resolve
login.microsoftonline.com due to incorrect DNS settings. This can be identified by running
Resolve-DnsName login.microsoftonline.com and checking for valid IP addresses. If the device resolves to an internal DNS server instead of Microsoft’s public DNS, the Azure AD join will fail.
2. Firewall/Proxy Blocking Azure AD Endpoints
Firewall rules or proxy misconfigurations may block outbound HTTPS traffic to
login.microsoftonline.com. Use
Test-NetConnection -ComputerName login.microsoftonline.com -Port 443 to verify connectivity. If the test fails, inspect firewall rules for
Windows Defender Firewall with Advanced Security or third-party solutions.
3. Registry Misconfiguration in OOBE
A misconfigured
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE key can force the device into a state where Azure AD join is bypassed or delayed. Specifically, a non-zero value in
DisableEnterpriseOobe or an invalid
BypassOOBE setting can trigger this error.
Fix Procedure
- Verify DNS resolution:
Resolve-DnsName login.microsoftonline.com
If DNS resolution fails, update DNS servers using:
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddress 8.8.8.8,8.8.4.4
- Test connectivity to Azure AD endpoints:
Test-NetConnection -ComputerName login.microsoftonline.com -Port 443
If connectivity is blocked, adjust firewall rules in Intune admin center > Devices > Configuration profiles > Network > Firewall.
- Correct OOBE registry settings:
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE" -Name "DisableEnterpriseOobe" -Value 0
Modifying the OOBE registry key on an enrolled device can cause re-enrollment failures. Always test in a lab environment first.
- Deploy a proxy configuration policy via OMA-URI:
./Device/Vendor/MSFT/Policy/Config/WindowsFirewall/ProxySettings
Use Set-CMDevicePolicy in Configuration Manager or Intune to enforce proxy settings.
Error Code Variants
| Error Code | Description | Distinguishing Factor |
| 0x801C0399 | Azure AD join failure due to network/DNS | Occurs during OOBE; logs reference login.microsoftonline.com |
| 0x801C0398 | General enrollment timeout | Occurs post-OOBE; logs reference Microsoft Graph API |
| 0x801C039A | Credential validation failure | Occurs during user sign-in; logs reference dsregcmd errors |
Verification
After applying fixes, verify success by checking
SetupOOBE.log for the line:
[AzureADJoin] Successfully joined Azure AD
Run
dsregcmd /status to confirm
AzureAdJoined: YES. In the
Intune admin center > Devices > All devices, the device should show an
Enrollment status: Success. Additionally, ensure
Get-AutopilotDevice | Where-Object serialNumber -eq $serial returns a valid device with
enrollmentState: succeeded.
Prevention
To prevent recurrence, enforce DNS policies via Intune:
Intune admin center > Devices > Configuration profiles > Create profile > Network > DNS
Deploy a baseline policy to lock down the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE registry key using
Set-CMDevicePolicy. Additionally, use
Get-MgDeviceManagementDeviceCompliancePolicy to audit compliance with Azure AD join requirements.
Use Test-NetConnection with the -TraceRoute parameter to quickly identify network hops causing latency to Microsoft endpoints.