Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Error code 0x87D00221 | DHA service unreachable or TPM attestation failed | Microsoft Intune diagnostic logs | -> |
| Adjacent error codes | 0x87D00220 (unexpected response), 0x87D00222 (cert validation failed) | Microsoft documentation | -> |
| Diagnostic log path | C:\Windows\Temp\MDMDiagnostics\MDMDiagReport.cab | File system | -> |
| Event Log path | C:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider%4Admin.evtx | Event Viewer | -> |
| Registry key for health cert | HKLM\SOFTWARE\Microsoft\Enrollments\{EnrollmentID}\SslClientCertificate | Registry editor | -> |
Log Files to Check
C:\Windows\Temp\MDMDiagnostics\MDMDiagReport.cabC:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider%4Admin.evtx
What This Error Actually Means
The error code 0x87D00221 is raised during a compliance policy evaluation failure, specifically when the Device Health Attestation (DHA) service endpoint athttps://has.spserv.microsoft.com/DeviceHealthAttestation cannot be reached or if there's an issue with TPM attestation. This error indicates that the device failed to communicate successfully with Microsoft’s DHA service, which is crucial for ensuring compliance and security policies are enforced.
Adjacent error codes in this family include:
- 0x87D00220: Unexpected response from the DHA service.
- 0x87D00221: DHA service unreachable or TPM attestation failed (our primary focus).
- 0x87D00222: Certificate validation failure during the health check process.
The differentiation between these codes is critical for troubleshooting. For instance, if you encounter 0x87D00220, it suggests a network issue or unexpected behavior from the DHA service rather than an attestation problem. Conversely, 0x87D00221 points directly to connectivity issues with the DHA endpoint or TPM-related problems.
Affected Versions and Scope
This error primarily affects Windows 11 devices running build 23H2 (and possibly later builds) that are enrolled in Microsoft Intune. The scope of this issue is limited to environments where compliance policies are actively enforced, especially those involving TPM attestation for device health checks. It's important to note that while the error can occur on any Windows 11 device with a compatible build, it does not affect devices running older versions like Windows 10 or earlier. Additionally, this issue is tenant-specific and may vary based on how compliance policies are configured in Intune.Where To Look First: Logs and Event IDs
To diagnose the root cause of error code 0x87D00221, start by examining the following logs: -C:\Windows\Temp\MDMDiagnostics\MDMDiagReport.cab: This compressed file contains detailed diagnostic information about the device's state at the time of failure. Extract and review this file for any entries related to compliance evaluation.
- C:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider%4Admin.evtx: This event log contains administrative-level events from the Device Management Enterprise Diagnostics Provider, which includes logs about DHA service communication and TPM attestation attempts.
- C:\Windows\System32\winevt\Logs\Microsoft-Windows-TPM-WMI%4Operational.evtx: For issues related to TPM functionality, this log will provide operational details that can help identify whether the TPM is functioning correctly.
Specifically, look for entries with Event ID 832 (DHA unreachable) and Event ID 64 (TPM attestation failure). These events are critical in pinpointing whether the issue lies within network connectivity or TPM functionality. Additionally, Event ID 404 can provide context on compliance check failures.
Root Causes
Network Connectivity Issues with DHA Service Endpoint
If your device is unable to reachhttps://has.spserv.microsoft.com/DeviceHealthAttestation, it could be due to network restrictions, firewall rules, or proxy settings that block access. This can also occur if the endpoint itself is experiencing downtime.
TPM Not Ready or Enabled on Device
The TPM must be present and ready for attestation checks to pass successfully. IfGet-Tpm returns TpmPresent but not TpmReady, it indicates that the TPM needs initialization or configuration adjustments.
Certificate Validation Failure During Health Check
If the health certificate stored inHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Enrollments\{EnrollmentID}\SslClientCertificate is invalid or missing, the DHA service will fail to validate it and return an error.
Fix Procedure
- Check Network Connectivity: Use PowerShell cmdlet
Test-NetConnection -ComputerName has.spserv.microsoft.com -Port 443. Ensure that your network allows outbound connections to the DHA service endpoint. - Verify TPM Status: Run
Get-Tpmin PowerShell. If TpmReady is False, initialize TPM withInitialize-Tpm -AllowClear. - Update Health Certificate: Use Intune's device compliance policy to update the health certificate via OMA-URI:
.//Device/Vendor/MSFT/HealthAttestation/Certificate. This ensures that a valid and up-to-date certificate is present for attestation. - Review Event Logs: Navigate to
Intune > Devices > Device management logsin the Microsoft Endpoint Manager admin center. Look for entries related to DHA service communication or TPM status.
Be cautious when initializing TPM with
-AllowClear, as this can reset all TPM settings and may affect enrolled devices.Error Code Variants
| Code | Description | Distinguishing Features |
|---|---|---|
0x87D00220 |
Unexpected response from DHA service. | Network issues or unexpected behavior from the endpoint. |
0x87D00221 |
DHA service unreachable or TPM attestation failed. | Primary focus, indicates connectivity or TPM issues. |
0x87D00222 |
Certificate validation failure during health check. | Issues with the SSL client certificate used for attestation. |
0x87D00223 |
Unknown error or internal service issue. | Generic fallback code when other specific errors do not apply. |
Verification
To verify that the fix has worked, check for Event ID 404 in the event logs indicating successful compliance checks. Additionally, review the MDMDiagnostics log for entries confirming a healthy state of TPM and DHA service communication.A quick diagnostic shortcut is to use
Get-Tpm | Format-List in PowerShell to get detailed TPM status without diving into logs.