EASYENTRA Blog

News & Updates

How to Find Stale Devices in Microsoft Entra ID

How to Safely Clean Up Stale Devices in Microsoft Entra ID

Devices are constantly added to Microsoft Entra ID as employees join an organization, sign in from new computers, or register mobile/personal devices for work access. But device records don’t always disappear when physical device is no longer in use. Over time, these unused device objects accumulate and become stale devices. A tenant with large number of devices can quickly become difficult to manage when administrators cannot easily distinguish active devices from devices that haven’t been used for months. In this guide, you will learn how to find stale devices in Microsoft Entra ID.

What are Stale Devices in Microsoft Entra ID

A stale device is generally a device registered in Microsoft Entra ID that hasn’t been used to access cloud applications for a specified period. Microsoft Entra ID doesn’t apply a universal definition such as: A device becomes stale after exactly 90 days. Instead, your organization must determine what inactivity period should classify a device as stale.

For example, you might consider:

  • Devices inactive for 30 days as potentially inactive.
  • Devices inactive for 90 days as stale.
  • Devices inactive for 180 days as ready for cleanup.
  • Devices inactive for 365 days as highly likely to be abandoned

The appropriate threshold depends on your organization’s device lifecycle and working patterns. Now, let’s get into how to find and manage inactive devices in Entra ID.

How to Find Stale Devices in the Microsoft Entra

To find stale devices in Microsoft Entra ID, administrators can use either the Microsoft Entra admin center or Microsoft Graph PowerShell. The Microsoft Entra admin center is useful when you need to manually review a smaller number of devices. Microsoft Graph PowerShell is more suitable for large tenants where administrators need to identify hundreds or thousands of inactive device objects.

Before deleting inactive devices, make sure you have the required permissions. To manage and delete devices in Microsoft Entra ID, you must hold an appropriate Microsoft Entra role, such as Cloud Device Administrator, Intune Administrator, or Global Administrator, depending on the device and management scenario.

Method 1: Using the Microsoft Entra Admin Center

The Microsoft Entra admin center provides a graphical interface for reviewing device activity and identifying devices that have not been used recently.

  1. Sign in to the Microsoft Entra admin center.
  2. Navigate to the Entra ID > Devices.
  3. You can use the built-in Stale devices card on the Devices Overview page for quick identification.
  4. Alternatively, go to the All devices page, select the Activity filter, and specify a date range to identify inactive devices in the Microsoft Entra admin center.

From that page, you can also select the stale devices and click Disable. Wait a grace period (e.g., 30 days) to ensure no active users are impacted before clicking Delete.

Method 2: Using Microsoft Graph PowerShell

If you have a large environment, PowerShell is the most efficient way to identify and remove stale devices. Before proceeding, make sure you connect to Microsoft Graph PowerShell module.

Connect-MgGraph -Scopes "Device.ReadWrite.All" 

The Device.ReadWrite.All permission allows the session to read and update device information. Depending on your tenant configuration, administrator consent may be required for this permission.

To find all devices that haven’t logged in for the last 6 months, run the following.

$dt = (Get-Date).AddMonths(-6) 
Get-MgDevice -All | Where-Object { $_.ApproximateLastSignInDateTime -le $dt } | Select-Object DisplayName, DeviceId, ApproximateLastSignInDateTime, AccountEnabled 

The output displays the device name, device ID, approximate last sign-in date, and current account status. Administrators can use this information to review inactive devices and determine whether they should be disabled or investigated further.

To automatically disable devices that fit your stale criteria, you can pipe the cmdlet like below.

$dt = (Get-Date).AddMonths(-6) 
$staleDevices = Get-MgDevice -All | Where-Object { $_.ApproximateLastSignInDateTime -le $dt -and $_.AccountEnabled -eq $true } 
 foreach ($device in $staleDevices) { 
    Update-MgDevice -DeviceId $device.Id -AccountEnabled $false 
}

This script changes the AccountEnabled property of each stale device to $false. The device object remains in Microsoft Entra ID, but the disabled device can no longer authenticate through Microsoft Entra ID.

Critical Precautions Before Deleting Stale Devices in Entra ID

The following are the important points to consider before deleting inactive Entra ID devices.

  • Deleting a Windows physical device permanently deletes its stored BitLocker keys. Verify that you have backed up keys elsewhere before processing removals.
  • Devices deployed via Windows Autopilot or managed via Microsoft Intune cannot be deleted directly from the Entra ID blade until they are retired or deleted from their primary management portal first.
  • Microsoft recommends disabling target stale devices first (accountEnabled = $false) for 30 days before executing a permanent delete script. This prevents permanent accidents if an employee returns from a long leave of absence.

Regularly identifying stale devices helps maintain a clean and manageable Microsoft Entra ID environment. Whether you use the Microsoft Entra admin center or Microsoft Graph PowerShell, always review and disable inactive devices before permanently deleting them to avoid impacting legitimate users.

Free 30-minute demo

try 30 days for free

GET EASYENTRA NEWS

Opt out at any time

“One of the best products I've used.”
Gary Shurland
Chief Information Officer, Mirick, United States
“This tool has been invaluable in streamlining our IT processes.”
Tyson Mckay
Chief Information Officer, Southwest Network, United States
“This product has been a miracle for our Help Desk. EasyEntra has completely transformed how we handle Microsoft 365 administration.”
Doug Sanders
Manager of Technical Customer Support, Junior Achievement USA, United States
“Your product is such a time saver. I love it!”
Scott Fehr
IT Infrastructure, MEC Aerial Work Platforms, United States
“It's a good product and saves us lots of time for these ongoing quick admin tasks.” 
Chris McFerran
Managing Director, CTech IT Solutions Ltd, United Kingdom
“EasyEntra has significantly streamlined our workflow, simplifying everything. It feels almost like a revolution.”
Johan Sadelius
IT-chef, Arjeplog Kommun, Sweden
I greatly appreciate your assistance and willingness to enhance the already outstanding product.”
Michael I. Wilson
Executive Director of Information Technology, Archdiocese Of Washington, United States
“It's great not having to switch back and forth between the O365 admin center and the Teams admin center to assign groups. I am sold!”
Thomas Madden
Director Information Technology, AutoPayPlus, United States
“I would highly recommend organizations use the solution as it greatly simplifies various tasks.”
S. Roger Singh
Chief Technology Officer, Prasad & Company LLP, Canada
“EasyEntra is time-saving. Love the copy/paste for user/computer groups and the copy to new user.”
Damian Nita
Associate Network Administrator, Shenandoah Valley Westminster-Canterbury, United States
“EasyEntra has transformed our daily IT operations by simplifying user management, reducing errors, and enhancing overall efficiency.”
Henrik Nefling
IT- and Digitalization Manager, Animal Protection Denmark, Denmark