Error Details
| Fact | Value | Source | Note |
|---|---|---|---|
| Exact error string | Something went wrong. The access couldn't be granted. Error: 0x80180013 | Windows Settings > Accounts > Access work or school | -> |
| Affected OS builds | Windows 10, Windows 11 | Microsoft Intune documentation | -> |
| Registry key involved | HKLM\SOFTWARE\Microsoft\Enrollments | Registry Editor (regedit) | Contains AADResourceID and MDMServiceUrl values |
| Relevant service endpoint URL | https://mdm.microsoft.com | MDM diagnostic logs | -> |
| Log line signature | Enrollment failed with error code 0x80180013 | Windows Event Viewer (Event ID 76) | -> |
Log Files to Check
C:\MDMDiag.cab (extracted from mdmdiagnosticstool.exe output)Microsoft-Windows-Provisioning-Diagnostics-Provider channel logs
What This Error Actually Means
The error code0x80180013 indicates that during Microsoft Intune MDM enrollment, the device failed to complete Auto-MDM enrollment because it was not recognized as eligible by the Intune service. This error is raised by the Windows Device Management (MDM) component when communication with the Intune service fails due to eligibility issues. The error typically appears in the following scenarios:
- Windows Settings > Accounts > Access work or school > Connect, displaying "Something went wrong. The access couldn't be granted. Error: 0x80180013"
- Windows Autopilot enrollment flows showing failure with code
0x80180013in the Enrollment Status Page (ESP)
Affected Versions and Scope
This error affects devices running:- Windows 10, all builds
- Windows 11, all builds
Where To Look First: Logs and Event IDs
To diagnose this error, examine the following log sources:- Windows Event Viewer: Navigate to
Event Viewer > Applications and Services Logs > Microsoft > Windows > DeviceManagement-Enterprise-Diagnostics-Provider > Admin. Filter for events with ID76 (Enrollment failed)and1 (MDM Enrollment error), specifically looking for the log line:Enrollment failed with error code 0x80180013 - MDM Diagnostic Report: Run the following PowerShell command to generate a diagnostic report:
mdmdiagnosticstool.exe -area Autopilot;DeviceEnrollment -cab C:\MDMDiag.cabExtract and review logs from theMicrosoft-Windows-Provisioning-Diagnostics-Providerchannel in the generatedC:\MDMDiag.cabfile. - Intune Admin Center: Navigate to
Devices > Windows > Windows enrollment > Enrollment failuresand filter by device or date to find the failed enrollment record. Look for associated AADSTS error codes or sub-errors. - Registry: Check the registry key
HKLM\SOFTWARE\Microsoft\Enrollments. Each enrolled account has a GUID subkey containing values likeAADResourceIDandMDMServiceUrl, which indicate the tenant and MDM endpoint the device attempted to contact.
Root Causes
The error can result from several distinct issues:1. Missing Intune License on User Account
The Azure AD user's UPN does not have an active Microsoft Intune Plan 1 or EMS/M365 license assigned. Intune requires a valid license to enroll devices in MDM.2. Incorrect MDM Scope Configuration
In the Entra admin center, the MDM scope is set to "Some" users/devices but the target user/device is not included in the specified groups.3. Stale Device Records in Azure AD
The device was previously enrolled with a different tenant or account, leaving behind stale records that block re-enrollment under the correct tenant.4. Conditional Access Policies Blocking Enrollment
A Conditional Access policy is preventing MDM enrollment from devices that are not yet compliant or registered, creating a catch-22 scenario.5. Terms of Use Not Accepted
If Terms of Use (ToU) are required for enrollment, the user has not accepted them, causing the enrollment to fail.Fix Procedure
Follow these steps in order:- Verify Intune Licensing:
Microsoft 365 admin center > Users > Active users > select user > Licenses and apps. Ensure an Intune or EMS license is assigned and the "Microsoft Intune" service is enabled. - Check MDM Scope Configuration:
Navigate to
Entra admin center > Identity > Mobility (MDM and WIP) > Microsoft Intune. Confirm the MDM user scope is set to "All" or that the affected user/device is included in the specified groups under "Some". - Remove Stale Device Records:
Go to
Entra admin center > Identity > Devices > All devices. Search for the device by name or serial number and delete any duplicate or stale records. Use PowerShell to verify remaining devices:Get-MgDeviceManagementManagedDevice -Filter "deviceEnrollmentType eq 'windowsAutoEnrollment'" - Review Conditional Access Policies:
Use the What If tool in
Entra admin center > Protection > Conditional Access > What If. Simulate enrollment using the user account and "Microsoft Intune Enrollment" app to identify blocking policies. Modify or exclude the enrollment app from restrictive policies. - Check Terms of Use Acceptance:
Navigate to
Entra admin center > Protection > Conditional Access > Terms of use. Verify if a ToU is required and whether the user has accepted it. If necessary, temporarily disable ToU enforcement for enrollment purposes. - Force Re-enrollment:
After resolving the above issues, force re-enrollment using:
dsregcmd /statusto check current status anddsregcmd /unregisterfollowed by a restart to initiate fresh enrollment.
Important: Be cautious when deleting stale device records. Verify the device is truly redundant before removal, as accidental deletion of active enrollments can cause issues.
Error Code Variants
| Error Code | Description |
|---|---|
| 0x80180013 | Device not recognized as eligible for MDM enrollment |
| 0x8018002D | Invalid device or user state (e.g., device already enrolled) |
| 0x80180035 | Device not found in Azure AD during enrollment |
Verification
After applying fixes, verify successful enrollment by:- Checking the device appears in
Intune admin center > Devices > All devices - Reviewing Windows Event Viewer for success messages in the same log areas (
Microsoft-Windows-DeviceManagement-Enterprise-Diagnostics-Provider/Admin) - Confirming the device reports compliant status via:
Get-MgDeviceComplianceManagedDeviceComplianceStatus -DeviceId $deviceId
Prevention
Implement these measures to avoid recurrence:- Regularly audit user licenses and MDM scope configurations
- Monitor Azure AD devices for stale records using:
Get-MgDevice -Filter "deviceEnrollmentType eq 'windowsAutoEnrollment'" - Review Conditional Access policies to ensure enrollment flows are properly excluded when necessary
- Maintain up-to-date Terms of Use acceptance tracking
Quick Tip: Use
dsregcmd /status as a quick diagnostic tool to check enrollment status and troubleshoot connectivity issues without digging into logs.