Skip to content

Commit 0bce97b

Browse files
authored
Merge pull request #187408 from MicrosoftGuyJFlo/StaleDevicesUpdate
[Azure AD] Devices - Stale devices update
2 parents ebd4bd2 + ee4d6c6 commit 0bce97b

File tree

1 file changed

+33
-17
lines changed

1 file changed

+33
-17
lines changed

articles/active-directory/devices/manage-stale-devices.md

Lines changed: 33 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services: active-directory
66
ms.service: active-directory
77
ms.subservice: devices
88
ms.topic: how-to
9-
ms.date: 06/02/2021
9+
ms.date: 02/07/2022
1010

1111
ms.author: joflore
1212
author: MicrosoftGuyJFlo
@@ -19,13 +19,13 @@ ms.collection: M365-identity-device-management
1919
---
2020
# How To: Manage stale devices in Azure AD
2121

22-
Ideally, to complete the lifecycle, registered devices should be unregistered when they are not needed anymore. However, due to, for example, lost, stolen, broken devices, or OS reinstallations you typically have stale devices in your environment. As an IT admin, you probably want a method to remove stale devices, so that you can focus your resources on managing devices that actually require management.
22+
Ideally, to complete the lifecycle, registered devices should be unregistered when they aren't needed anymore. Because of lost, stolen, broken devices, or OS reinstallations you'll typically have some stale devices in your environment. As an IT admin, you probably want a method to remove stale devices, so that you can focus your resources on managing devices that actually require management.
2323

2424
In this article, you learn how to efficiently manage stale devices in your environment.
2525

2626
## What is a stale device?
2727

28-
A stale device is a device that has been registered with Azure AD but has not been used to access any cloud apps for a specific timeframe. Stale devices have an impact on your ability to manage and support your devices and users in the tenant because:
28+
A stale device is a device that has been registered with Azure AD but hasn't been used to access any cloud apps for a specific timeframe. Stale devices have an impact on your ability to manage and support your devices and users in the tenant because:
2929

3030
- Duplicate devices can make it difficult for your helpdesk staff to identify which device is currently active.
3131
- An increased number of devices creates unnecessary device writebacks increasing the time for Azure AD connect syncs.
@@ -35,7 +35,7 @@ Stale devices in Azure AD can interfere with the general lifecycle policies for
3535

3636
## Detect stale devices
3737

38-
Because a stale device is defined as registered device that hasn't been used to access any cloud apps for a specific timeframe, detecting stale devices requires a timestamp-related property. In Azure AD, this property is called **ApproximateLastLogonTimestamp** or **activity timestamp**. If the delta between now and the value of the **activity timestamp** exceeds the timeframe you have defined for active devices, a device is considered to be stale. This **activity timestamp** is now in public preview.
38+
Because a stale device is defined as a registered device that hasn't been used to access any cloud apps for a specific timeframe, detecting stale devices requires a timestamp-related property. In Azure AD, this property is called **ApproximateLastLogonTimestamp** or **activity timestamp**. If the delta between now and the value of the **activity timestamp** exceeds the timeframe you've defined for active devices, a device is considered to be stale. This **activity timestamp** is now in public preview.
3939

4040
## How is the value of the activity timestamp managed?
4141

@@ -79,7 +79,7 @@ Define a timeframe that is your indicator for a stale device. When defining your
7979

8080
### Disable devices
8181

82-
It is not advisable to immediately delete a device that appears to be stale because you can't undo a deletion if there is a false positive. As a best practice, disable a device for a grace period before deleting it. In your policy, define a timeframe to disable a device before deleting it.
82+
It isn't advisable to immediately delete a device that appears to be stale because you can't undo a deletion if there's a false positive. As a best practice, disable a device for a grace period before deleting it. In your policy, define a timeframe to disable a device before deleting it.
8383

8484
### MDM-controlled devices
8585

@@ -99,30 +99,30 @@ To clean up Azure AD:
9999
- **Windows 7/8** - Disable or delete Windows 7/8 devices in your on-premises AD first. You can't use Azure AD Connect to disable or delete Windows 7/8 devices in Azure AD. Instead, when you make the change in your on-premises, you must disable/delete in Azure AD.
100100

101101
> [!NOTE]
102-
>* Deleting devices in your on-premises AD or Azure AD does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g. Conditional Access). Read additional information on how to [remove registration on the client](faq.yml).
103-
>* Deleting a Windows 10 device only in Azure AD will re-synchronize the device from your on-premises using Azure AD connect but as a new object in "Pending" state. A re-registration is required on the device.
104-
>* Removing the device from sync scope for Windows 10/Server 2016 devices will delete the Azure AD device. Adding it back to sync scope will place a new object in "Pending" state. A re-registration of the device is required.
105-
>* If you are not using Azure AD Connect for Windows 10 devices to synchronize (e.g. ONLY using AD FS for registration), you must manage lifecycle similar to Windows 7/8 devices.
102+
> - Deleting devices in your on-premises AD or Azure AD does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g. Conditional Access). Read additional information on how to [remove registration on the client](faq.yml).
103+
> - Deleting a Windows 10 device only in Azure AD will re-synchronize the device from your on-premises using Azure AD connect but as a new object in "Pending" state. A re-registration is required on the device.
104+
> - Removing the device from sync scope for Windows 10/Server 2016 devices will delete the Azure AD device. Adding it back to sync scope will place a new object in "Pending" state. A re-registration of the device is required.
105+
> - If you are not using Azure AD Connect for Windows 10 devices to synchronize (e.g. ONLY using AD FS for registration), you must manage lifecycle similar to Windows 7/8 devices.
106106
107107
### Azure AD joined devices
108108

109109
Disable or delete Azure AD joined devices in the Azure AD.
110110

111111
> [!NOTE]
112-
>* Deleting an Azure AD device does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g Conditional Access).
113-
>* Read more on [how to unjoin on Azure AD](faq.yml)
112+
> - Deleting an Azure AD device does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g Conditional Access).
113+
> - Read more on [how to unjoin on Azure AD](faq.yml)
114114
115115
### Azure AD registered devices
116116

117117
Disable or delete Azure AD registered devices in the Azure AD.
118118

119119
> [!NOTE]
120-
>* Deleting an Azure AD registered device in Azure AD does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g. Conditional Access).
121-
>* Read more on [how to remove a registration on the client](faq.yml)
120+
> - Deleting an Azure AD registered device in Azure AD does not remove registration on the client. It will only prevent access to resources using device as an identity (e.g. Conditional Access).
121+
> - Read more on [how to remove a registration on the client](faq.yml)
122122
123123
## Clean up stale devices in the Azure portal
124124

125-
While you can clean up stale devices in the Azure portal, it is more efficient, to handle this process using a PowerShell script. Use the latest PowerShell V2 module to use the timestamp filter and to filter out system-managed devices such as Autopilot.
125+
While you can clean up stale devices in the Azure portal, it's more efficient, to handle this process using a PowerShell script. Use the latest PowerShell V2 module to use the timestamp filter and to filter out system-managed devices such as Autopilot.
126126

127127
A typical routine consists of the following steps:
128128

@@ -156,11 +156,26 @@ $dt = (Get-Date).AddDays(-90)
156156
Get-AzureADDevice -All:$true | Where {$_.ApproximateLastLogonTimeStamp -le $dt} | Set-AzureADDevice -AccountEnabled $false
157157
```
158158

159+
### Delete devices
160+
161+
> [!CAUTION]
162+
> The `Remove-AzureADDevice` cmdlet does not provide a warning. Running this command will delete devices without prompting. **There is no way to recover deleted devices**.
163+
164+
Before deleting any devices, back up any BitLocker recovery keys you may need in the future. There's no way to recover BitLocker recovery keys after deleting the associated device.
165+
166+
Building on the [disable devices example](#disable-devices) we look for disabled devices, now inactive for 120 days, and pipe the output to `Remove-AzureADDevice` to delete those devices.
167+
168+
```powershell
169+
$dt = (Get-Date).AddDays(-120)
170+
$state = $false
171+
Get-AzureADDevice -All:$true | Where {($_.ApproximateLastLogonTimeStamp -le $dt) -and ($_.AccountEnabled -le $state)} | Remove-AzureADDevice
172+
```
173+
159174
## What you should know
160175

161176
### Why is the timestamp not updated more frequently?
162177

163-
The timestamp is updated to support device lifecycle scenarios. This attribute is not an audit. Use the sign-in audit logs for more frequent updates on the device.
178+
The timestamp is updated to support device lifecycle scenarios. This attribute isn't an audit. Use the sign-in audit logs for more frequent updates on the device.
164179

165180
### Why should I worry about my BitLocker keys?
166181

@@ -169,9 +184,10 @@ When configured, BitLocker keys for Windows 10 devices are stored on the device
169184
### Why should I worry about Windows Autopilot devices?
170185

171186
When you delete an Azure AD device that was associated with a Windows Autopilot object the following three scenarios can occur if the device will be repurposed in future:
187+
172188
- With Windows Autopilot user-driven deployments without using pre-provisioning, a new Azure AD device will be created, but it won’t be tagged with the ZTDID.
173-
- With Windows Autopilot self-deploying mode deployments, they will fail because an associate Azure AD device cannot be found. (This failure is a security mechanism to make sure that no “imposter” devices try to join Azure AD with no credentials.) The failure will indicate a ZTDID mismatch.
174-
- With Windows Autopilot pre-provisioning deployments, they will fail because an associated Azure AD device cannot be found. (Behind the scenes, pre-provisioning deployments use the same self-deploying mode process, so they enforce the same security mechanisms.)
189+
- With Windows Autopilot self-deploying mode deployments, they'll fail because an associate Azure AD device can’t be found. (This failure is a security mechanism to make sure that no “imposter” devices try to join Azure AD with no credentials.) The failure will indicate a ZTDID mismatch.
190+
- With Windows Autopilot pre-provisioning deployments, they'll fail because an associated Azure AD device can’t be found. (Behind the scenes, pre-provisioning deployments use the same self-deploying mode process, so they enforce the same security mechanisms.)
175191

176192
### How do I know all the type of devices joined?
177193

0 commit comments

Comments
 (0)