Home › Microsoft Intune › 0x87D00221

Microsoft Intune · 0x87D00221 · Windows 11 23H2

Microsoft Intune Error 0x87D00221: Device Health Attestation Failure on Windows 11

The error occurs when the DHA service is unreachable or TPM attestation fails. Fix by checking network connectivity to has.spserv.microsoft.com and verifying TPM status.

Error Details

FactValueSourceNote
Error code 0x87D00221DHA service unreachable or TPM attestation failedMicrosoft Intune diagnostic logs->
Adjacent error codes0x87D00220 (unexpected response), 0x87D00222 (cert validation failed)Microsoft documentation->
Diagnostic log pathC:\Windows\Temp\MDMDiagnostics\MDMDiagReport.cabFile system->
Event Log pathC:\Windows\System32\winevt\Logs\Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider%4Admin.evtxEvent Viewer->
Registry key for health certHKLM\SOFTWARE\Microsoft\Enrollments\{EnrollmentID}\SslClientCertificateRegistry editor->

Log Files to Check

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 at https://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 reach https://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. If Get-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 in HKEY_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

  1. 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.
  2. Verify TPM Status: Run Get-Tpm in PowerShell. If TpmReady is False, initialize TPM with Initialize-Tpm -AllowClear.
  3. 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.
  4. Review Event Logs: Navigate to Intune > Devices > Device management logs in 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.

Prevention

To prevent recurrence, ensure that your network policies allow outbound connections to the DHA service endpoint and regularly update health certificates via Intune's device compliance policy. Implementing a baseline check for TPM readiness as part of your standard deployment process can also help mitigate issues before they arise. By following these steps and maintaining vigilant monitoring of your environment, you can effectively manage and prevent errors related to 0x87D00221 in Microsoft Intune.

Sources & References

Related Guides

Get new error code fixes by email

Product-specific solutions for Intune, Autopilot, SCCM and Entra ID — straight to your inbox. No spam.