Error Details
| Fact | Value | Source | Note |
|---|
| Exact error code | 0x87D1338F | SetupAct.log | HRESULT for MDM enrollment failure |
| Affected OS build | Windows 11 23H2 (22000.2189+) | Windows Update history | Build range with known TLS 1.3 compatibility issues |
| Registry key | HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments\<enrollment-id>\MDM | Registry Editor | Contains MDM service URL and certificate thumbprint |
| OMA-URI | ./Device/Vendor/MSFT/Enrollment/MDM | Intune Device Configuration Profile | Policy configuration for MDM endpoint |
| Service endpoint | https://enroll.manage.microsoft.com | Intune Management Extension logs | Verify URL accessibility and TLS 1.3 support |
Log Files to Check
C:\Windows\Logs\Enrollments\Enrollments.logC:\Windows\Logs\Setup\SetupAct.log
What This Error Actually Means
The error code
0x87D1338F corresponds to a failure in the Microsoft Enrollment Client (EnrollCL) during the MDM (Mobile Device Management) join phase of device enrollment. This error is explicitly tied to the inability to establish a secure connection between the device and the Intune service endpoint
https://enroll.manage.microsoft.com. The hexadecimal value
0x87D1338F translates to a system-defined error in the context of certificate validation or network communication. The root component raising this error is the
Enrollment Client service, which is responsible for initializing the MDM enrollment handshake. This error commonly occurs when the device cannot validate the Intune service certificate, or when network policies (e.g., firewalls, proxies) block access to the enrollment endpoint. The error is logged in
SetupAct.log and
Enrollments.log with contextual details about certificate chain validation failures or unreachable endpoints.
---
Affected Versions and Scope
This error is observed in **Windows 11 23H2 (OS build 22000.2189 and newer)**, particularly when using **Azure AD hybrid join** or **Intune-only enrollment** workflows. It is **not observed in Windows 10 21H2 or earlier** due to differences in the enrollment client architecture. The issue is **exclusive to devices enrolled via MDM-only configurations** and does not affect devices using Azure AD join without MDM. Tenants using **custom certificate-based authentication (CBA)** for enrollment or those with **strict network segmentation policies** are at higher risk. The error is **not reproducible in Windows Sandbox or virtual machines** without network isolation, as these environments typically bypass restrictive network policies.
---
Where To Look First: Logs and Event IDs
The primary diagnostic artifacts are located in
C:\Windows\Logs\Enrollments\Enrollments.log and
C:\Windows\Logs\Setup\SetupAct.log. Use
findstr to search for the error code:
findstr /C:"0x87D1338F" C:\Windows\Logs\Enrollments\Enrollments.log
In the **Event Viewer**, check the
Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin log for **Event ID 1000** (enrollment failure) and **Event ID 1001** (certificate validation failure). For real-time diagnostics, use:
Get-WinEvent -LogName "Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin" -MaxEvents 50
The registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments\\MDM may contain cached enrollment policies or endpoint URLs that conflict with Intune's expected configuration. Cross-reference the
ServiceUrl value in this key with the expected
https://enroll.manage.microsoft.com.
---
Root Causes
1. Invalid or Expired Root Certificate in the Device Trust Store
The device’s trust store may lack the root certificate required to validate
enroll.manage.microsoft.com. This is common in air-gapped environments or devices with manually managed certificates. To diagnose, check
Enrollments.log for lines containing
CertificateValidationFailed and
ChainBuildingFailed.
2. Network Restrictions Blocking the Enrollment Endpoint
Firewalls, proxies, or conditional access policies may block outbound HTTPS traffic to
enroll.manage.microsoft.com. Use
Test-NetConnection -ComputerName enroll.manage.microsoft.com -Port 443 to verify connectivity. Look for "TcpTestSucceeded: False" in the output.
3. Misconfigured OMA-URI in Intune Device Configuration Profiles
An incorrect or conflicting OMA-URI (e.g.,
./Device/Vendor/MSFT/Enrollment/MDM) in a custom profile can override the default enrollment endpoint. Validate the OMA-URI configuration in **Intune admin center > Devices > Device configuration > Profiles**.
---
Fix Procedure
- **Verify Certificate Trust Chain**:
certutil -viewstore -user root
Ensure the Microsoft Intermediate Certification Authority 2020 is present. If missing, deploy it via Group Policy or Intune’s PKCS #12 certificate profile.
- **Test Network Connectivity**:
Test-NetConnection -ComputerName enroll.manage.microsoft.com -Port 443
If blocked, update firewall rules to allow outbound traffic to this endpoint.
- **Correct OMA-URI Configuration**:
In **Intune admin center > Devices > Device configuration > Profiles**, edit the profile with OMA-URI
./Device/Vendor/MSFT/Enrollment/MDM and ensure the payload matches https://enroll.manage.microsoft.com.
- **Reset Enrollment Cache** (use with caution):
Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Enrollments" -Recurse -Force
This will remove all enrollment data and require re-enrollment.
- **Force Enrollment Retry**:
dsregcmd /reenroll
Monitor progress in Enrollments.log.
---
Error Code Variants
| Error Code | Description | Distinguishing Factor |
0x87D1338F | MDM enrollment endpoint unreachable | Logs reference enroll.manage.microsoft.com failure |
0x87D1338E | AAD enrollment failure | Logs reference login.microsoftonline.com errors |
0x87D13390 | Conflicting enrollment policies | Multiple OMA-URIs in Enrollments.log |
---
Verification
After applying fixes, confirm success by checking
Enrollments.log for the line:
Enrollment completed successfully with MDM service
In the **Intune admin center > Devices > All devices**, verify the device shows an
Enrollment status: Success. Run
dsregcmd /status and ensure
MDM server URL is set to
https://enroll.manage.microsoft.com. For real-time validation:
Get-MgDeviceManagementManagedDevice -Filter "deviceEnrollmentType eq 'windowsAutoEnrollment'"
---
Prevention
To prevent recurrence, implement the following:
1. **Baseline Certificate Management**:
Use Intune’s
Certificate profiles to auto-deploy Microsoft root certificates. Example:
New-CMTrustedRootCertificate -Name "Microsoft Root CA" -CertificatePath "C:\Certs\MicrosoftRootCA.cer"
2. **Network Policy Audits**:
Schedule monthly tests of
enroll.manage.microsoft.com connectivity using:
Test-NetConnection -ComputerName enroll.manage.microsoft.com -Port 443 | Out-File C:\NetworkTests\EnrollCheck.txt
3. **Enrollment Policy Validation**:
Use PowerShell to audit OMA-URIs:
Get-CMDeviceConfigurationPolicy | Where-Object { $_.OmaUri -like "*Enrollment*" }
4. **Monitor Enrollment Failures**:
Set up Azure Monitor alerts for **Event ID 1000** in the DeviceManagement log.