Stale Entra ID Devices: Find and Retire Them Safely

Stale devices are Entra ID records without cloud-application access during the approved inactivity timeframe. Compare ApproximateLastSignInDateTime with that threshold before reviewing candidates.
I treat the timestamp as a review trigger, not proof of retirement, because an old record can belong to a retired laptop, a seasonal endpoint, or someone on extended leave. Separate those cases before giving any cleanup command write access.
Key takeaways
- Use the activity timestamp to identify candidates, but never classify devices with timestamps younger than 21 days as stale.
- Reconcile Entra ID with Intune, Windows Autopilot, and on-premises Active Directory before approving changes.
- Retire managed endpoints first, disable approved identities, and record a grace period before permanent deletion.
Why stale devices keep accumulating
Device registration creates an identity record, but registered devices can remain in the directory after their hardware leaves service. Reimaging, replacement laptops, repeated registrations, Microsoft 365 migrations, and incomplete offboarding all leave objects behind.

Duplicate display names make this worse. Matching by display name alone isn't enough. Several device objects can share a familiar computer name but have different registration histories. I compare directory object IDs, device IDs, ownership, and management records before deciding which object represents the working endpoint.
Intune housekeeping doesn't close that gap. Its cleanup policy hides inactive Intune records after a configured period of 30 to 270 days; 90 days is a common starting point. It doesn't retire or wipe endpoints, and it doesn't delete Entra ID objects. Entra ID has no equivalent built-in age-based cleanup rule.
My Intune device cleanup guidance separates console housekeeping from actual retirement. Without that distinction, the dashboard looks cleaner while the directory remains unchanged.
Read the activity timestamp correctly
Microsoft Entra ID's stale-device management guidance, updated November 22, 2026, names ApproximateLastSignInDateTime as the detection property. Microsoft also calls it the activity timestamp. The activity signal helps identify stale devices for review, while inactive devices still need corroborating evidence before action.
Understand what refreshes the value
The timestamp can update when a Conditional Access policy requiring managed devices or approved client applications is triggered. It also updates when Windows 10 or newer Microsoft Entra joined or hybrid joined devices are active on the network, or when Intune-managed devices check in.
Microsoft replaces the value when the gap exceeds 14 days, with a variance of plus or minus five days. This isn't a heartbeat.
A timestamp younger than 21 days must not be used as evidence of staleness. Leave, illness, and the update interval can make a working device appear inactive. I use 90 days as a review threshold for standard user endpoints, with separate rules for shared and seasonal equipment.
Investigate blanks and conflicting signals
The activity timestamp isn't an audit record. Use sign-in logs when you need more current authentication evidence, and compare Intune's last check-in and Microsoft Defender for Endpoint's last-seen information.
Some active devices have blank activity timestamps. Put those records in a separate investigation queue rather than treating null as an extremely old date.
Match records by device ID. A recent sign-in against another object with the same display name doesn't clear the candidate you are reviewing.
Find and export stale Entra ID devices
Review the portal before scripting
In the Microsoft Entra admin center, open Entra ID > Devices > All devices and review the Activity column. Include join type, enabled state, and operating system in your review.
Separate Microsoft Entra joined, hybrid joined, and registered devices. In Graph output, their TrustType values are AzureAd, ServerAd, and Workplace. Registration alone doesn't establish ownership or compliance.
Build a repeatable CSV report
Use the generally available Microsoft Graph PowerShell SDK. The Get-MgDevice reference documents the inventory command.
This read-only query exports inactive devices with nonblank activity timestamps older than 90 days:
Install-Module Microsoft.Graph.Identity.DirectoryManagement -Scope CurrentUser
Connect-MgGraph -Scopes "Device.Read.All"
$cutoff = [datetime]::UtcNow.AddDays(-90)
$devices = Get-MgDevice -All -Property Id,DeviceId,DisplayName,OperatingSystem,TrustType,AccountEnabled,ApproximateLastSignInDateTime
$devices |
Where-Object {
$null -ne $_.ApproximateLastSignInDateTime -and
$_.ApproximateLastSignInDateTime -lt $cutoff
} |
Select-Object Id,DeviceId,DisplayName,OperatingSystem,TrustType,AccountEnabled,ApproximateLastSignInDateTime |
Export-Csv .\stale-candidates.csv -NoTypeInformation
Treat the export as a review list, not authorization to change records. Keep both identifiers for each device object. Graph commands use the directory object's Id for their -DeviceId parameter, not the separate DeviceId property.
Add owner, disposition, exception reason, and approval fields to the review copy. The endpoint owner approves retirement; the identity administrator executes it. Save only approved rows in approved-stale.csv, preserving the Id column.
Apply the join-type and platform exceptions
Protect Autopilot and hybrid dependencies
Exclude Windows Autopilot devices from generic Entra deletion. Handle retirement and deregistration through the appropriate Windows Autopilot and Intune workflows. Deleting the Entra object independently can break later reprovisioning.
For Windows 10 or newer devices with Microsoft Entra hybrid join, manage the source computer account in on-premises Active Directory. Disable or delete it under the on-premises lifecycle policy and allow synchronization to complete.
Deleting only the cloud object causes it to synchronize back in a Pending state and requires device re-registration. Microsoft Entra Connect doesn't provide the same management path for legacy Windows 7 and Windows 8 devices.
Retire managed devices before directory cleanup
Retire Intune- or other MDM-managed devices before disabling or deleting their Entra identities. An Intune cleanup policy doesn't replace endpoint retirement or directory review. Confirm that retirement is complete, or document the unresolved offline endpoint.
For Android, reconcile the Entra device ID with the Intune record, enrollment type, ownership, and last check-in. A personally owned work-profile device and a corporate-owned dedicated device require different retirement decisions. Don't select a destructive action from timestamp age alone.
Shared POS terminals, kiosks, and loaner pools also need their own inactivity thresholds. A restaurant renovation can explain an offline terminal; it still needs a named owner, a business reason, and an exception expiry date.
Disable, wait, then delete with evidence
Microsoft's PowerShell cleanup walkthrough, updated October 28, 2026, follows the same sequence: inventory, disable, wait, then delete.

- Before you disable devices, confirm the batch is owner-approved. Exclude Autopilot records, complete MDM retirement, resolve hybrid dependencies, and preserve any required BitLocker recovery keys. Deleting the device also deletes keys stored on that object.
- Disable approved records using an appropriately authorized administrator. Record each successful change with its UTC timestamp:
Connect-MgGraph -Scopes "Device.ReadWrite.All"
foreach ($row in (Import-Csv .\approved-stale.csv)) {
Update-MgDevice -DeviceId $row.Id -AccountEnabled:$false -ErrorAction Stop
[pscustomobject]@{
Id = $row.Id
DisabledAtUtc = [datetime]::UtcNow.ToString("o")
} | Export-Csv .\disabled-devices.csv -Append -NoTypeInformation
}
- Treat the disable devices batch as the start of the grace period, not approval to remove records. I recommend 30 days after disablement for standard endpoints, with longer exceptions documented separately. Review support incidents, owner responses, and available activity evidence before creating
approved-delete.csv.
Teams must not delete devices until the approved grace period has elapsed and the final review is complete. Run deletion only against that final approval file:
foreach ($row in (Import-Csv .\approved-delete.csv)) {
$device = Get-MgDevice -DeviceId $row.Id -Property Id,AccountEnabled
if ($device.AccountEnabled -eq $false) {
Remove-MgDevice -DeviceId $device.Id -ErrorAction Stop
}
}
Remove-MgDevice provides no confirmation prompt, and deletion can't be undone. Keep approval and execution separate. A record crossing an age threshold doesn't establish that its grace period has elapsed.
Define the assessment and the handoff
For Microsoft 365 E3 as the licensing baseline, this work uses existing Entra ID and Intune capabilities. Moving to Microsoft 365 E5 doesn't fix an unowned device lifecycle.
I scope the assessment around inventory reconciliation, registration sources, join types, retirement dependencies, and exception ownership. The handoff should contain the reviewed CSV, approved thresholds, tested commands, change evidence, and a monthly review procedure. Your team should be able to repeat the work without reconstructing the decisions.
Where the review exposes missing compliance enforcement or device-hardening gaps, those belong in a separate remediation scope through our cybersecurity risk management services. Removing directory objects doesn't establish endpoint security.
A separate engagement isn't worth it when your team already has an accurate inventory, accountable owners, and a tested retirement runbook. Run the process internally. Outside help earns its place when conflicting records or ownership gaps prevent safe decisions.
Frequently asked questions
Does disabling a device wipe it or block Windows sign-in?
No. Disabling affects the device's ability to authenticate to Microsoft Entra ID and access resources through its device identity. It doesn't wipe local data or reliably prevent local Windows access. Handle endpoint recovery, wipe decisions, and user offboarding separately.
Can a device hidden by Intune cleanup return?
Yes. A hidden device can reappear when it checks in again before its management certificate expires. That is why I keep the review and retirement record outside the console view. Disappearing from an inventory screen isn't proof of disposal.
Make every deletion traceable
A defensible cleanup starts with an export and ends with an approved disposition. Keep the timestamp rules, platform dependencies, and disablement evidence attached to the decision.
The governing standard is simple: every deletion needs an owner, completed dependency checks, and a recorded grace period. A shorter device list isn't the acceptance criterion.
Book a free 30-minute call to scope a device-lifecycle review.
