Skip to content

Commit ed65eb8

Browse files
Merge pull request #233530 from shlipsey3/reports-stale-user-cleanup-040523
reports-stale-user-cleanup
2 parents 2ce5153 + 2d9db0b commit ed65eb8

File tree

3 files changed

+40
-45
lines changed

3 files changed

+40
-45
lines changed

articles/active-directory/reports-monitoring/howto-manage-inactive-user-accounts.md

Lines changed: 40 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,84 @@
11
---
2-
title: How to manage inactive user accounts in Azure AD
3-
description: Learn about how to detect and handle user accounts in Azure AD that have become obsolete
2+
title: How to manage inactive user accounts
3+
description: Learn how to detect and resolve user accounts that have become obsolete
44
services: active-directory
55
author: shlipsey3
66
manager: amycolannino
77
ms.service: active-directory
88
ms.topic: how-to
99
ms.workload: identity
1010
ms.subservice: report-monitor
11-
ms.date: 10/31/2022
11+
ms.date: 04/05/2023
1212
ms.author: sarahlipsey
1313
ms.reviewer: besiler
1414

1515
ms.collection: M365-identity-device-management
1616
---
17-
# How To: Manage inactive user accounts in Azure AD
17+
# How To: Manage inactive user accounts
1818

19-
In large environments, user accounts are not always deleted when employees leave an organization. As an IT administrator, you want to detect and handle these obsolete user accounts because they represent a security risk.
19+
In large environments, user accounts aren't always deleted when employees leave an organization. As an IT administrator, you want to detect and resolve these obsolete user accounts because they represent a security risk.
2020

21-
This article explains a method to handle obsolete user accounts in Azure AD.
21+
This article explains a method to handle obsolete user accounts in Azure Active Directory (Azure AD).
2222

2323
## What are inactive user accounts?
2424

25-
Inactive accounts are user accounts that are not required anymore by members of your organization to gain access to your resources. One key identifier for inactive accounts is that they haven't been used *for a while* to sign-in to your environment. Because inactive accounts are tied to the sign-in activity, you can use the timestamp of the last sign-in that was successful to detect them.
25+
Inactive accounts are user accounts that aren't required anymore by members of your organization to gain access to your resources. One key identifier for inactive accounts is that they haven't been used *for a while* to sign in to your environment. Because inactive accounts are tied to the sign-in activity, you can use the timestamp of the last sign-in that was successful to detect them.
2626

27-
The challenge of this method is to define what *for a while* means in the case of your environment. For example, users might not sign-in to an environment *for a while*, because they are on vacation. When defining what your delta for inactive user accounts is, you need to factor in all legitimate reasons for not signing in to your environment. In many organizations, the delta for inactive user accounts is between 90 and 180 days.
27+
The challenge of this method is to define what *for a while* means for your environment. For example, users might not sign in to an environment *for a while*, because they are on vacation. When defining what your delta for inactive user accounts is, you need to factor in all legitimate reasons for not signing in to your environment. In many organizations, the delta for inactive user accounts is between 90 and 180 days.
2828

2929
The last successful sign-in provides potential insights into a user's continued need for access to resources. It can help with determining if group membership or app access is still needed or could be removed. For external user management, you can understand if an external user is still active within the tenant or should be cleaned up.
3030

31-
32-
## How to detect inactive user accounts
31+
## Detect inactive user accounts with Microsoft Graph
32+
<a name="how-to-detect-inactive-user-accounts"></a>
3333

34-
You detect inactive accounts by evaluating the **lastSignInDateTime** property exposed by the **signInActivity** resource type of the **Microsoft Graph** API. The **lastSignInDateTime** property shows the last time a user made a successful interactive sign-in to Azure AD. Using this property, you can implement a solution for the following scenarios:
34+
You can detect inactive accounts by evaluating the `lastSignInDateTime` property exposed by the `signInActivity` resource type of the **Microsoft Graph API**. The `lastSignInDateTime` property shows the last time a user made a successful interactive sign-in to Azure AD. Using this property, you can implement a solution for the following scenarios:
3535

36-
- **Users by name**: In this scenario, you search for a specific user by name, which enables you to evaluate the lastSignInDateTime: `https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'markvi')&$select=displayName,signInActivity`
36+
- **Last sign-in date and time for all users**: In this scenario, you need to generate a report of the last sign-in date of all users. You request a list of all users, and the last `lastSignInDateTime` for each respective user:
37+
- `https://graph.microsoft.com/v1.0/users?$select=displayName,signInActivity`
3738

38-
- **Users by date**: In this scenario, you request a list of users with a lastSignInDateTime before a specified date: `https://graph.microsoft.com/v1.0/users?$filter=signInActivity/lastSignInDateTime le 2019-06-01T00:00:00Z`
39+
- **Users by name**: In this scenario, you search for a specific user by name, which enables you to evaluate the `lastSignInDateTime`:
40+
- `https://graph.microsoft.com/v1.0/users?$filter=startswith(displayName,'markvi')&$select=displayName,signInActivity`
3941

40-
> [!NOTE]
41-
> When you request the signInActivity property while listing users, the maximum page size is 120 users. Requests with $top set higher than 120 will fail. SignInActivity supports `$filter` (`eq`, `ne`, `not`, `ge`, `le`) *but* not with any other filterable properties.
42+
- **Users by date**: In this scenario, you request a list of users with a `lastSignInDateTime` before a specified date:
43+
- `https://graph.microsoft.com/v1.0/users?$filter=signInActivity/lastSignInDateTime le 2019-06-01T00:00:00Z`
4244

4345
> [!NOTE]
44-
> There may be the need to generate a report of the last sign in date of all users, if so you can use the following scenario.
45-
> **Last Sign In Date and Time for All Users**: In this scenario, you request a list of all users, and the last lastSignInDateTime for each respective user: `https://graph.microsoft.com/v1.0/users?$select=displayName,signInActivity`
46-
47-
## What you need to know
48-
49-
This section lists what you need to know about the lastSignInDateTime property.
50-
51-
### How can I access this property?
52-
53-
The **lastSignInDateTime** property is exposed by the [signInActivity resource type](/graph/api/resources/signinactivity) of the [Microsoft Graph API](/graph/overview#whats-in-microsoft-graph).
46+
> When you request the `signInActivity` property while listing users, the maximum page size is 120 users. Requests with $top set higher than 120 will fail. The `signInActivity` property supports `$filter` (`eq`, `ne`, `not`, `ge`, `le`) *but not with any other filterable properties*.
5447
55-
### Is the lastSignInDateTime property available through the Get-AzureAdUser cmdlet?
48+
### What you need to know
5649

57-
No.
50+
The following details relate to the `lastSignInDateTime` property.
5851

59-
### What edition of Azure AD do I need to access the property?
52+
- The `lastSignInDateTime` property is exposed by the [signInActivity resource type](/graph/api/resources/signinactivity) of the [Microsoft Graph API](/graph/overview#whats-in-microsoft-graph).
6053

61-
To access this property, you need an Azure Active Directory Premium edition.
54+
- The property is *not* available through the Get-AzureAdUser cmdlet.
6255

63-
### What permission do I need to read the property?
56+
- To access the property, you need an Azure Active Directory Premium edition license.
6457

65-
To read this property, you need to grant the app the following Microsoft Graph permissions:
58+
- To read the property, you need to grant the app the following Microsoft Graph permissions:
59+
- AuditLog.Read.All
60+
- Directory.Read.All
61+
- User.Read.All
6662

67-
- AuditLog.Read.All
68-
- Directory.Read.All
69-
- User.Read.All
70-
71-
72-
### When does Azure AD update the property?
73-
74-
Each interactive sign-in that was successful results in an update of the underlying data store. Typically, successful sign-ins show up in the related sign-in report within 10 minutes.
63+
- Each interactive sign-in that was successful results in an update of the underlying data store. Typically, successful sign-ins show up in the related sign-in report within 10 minutes.
7564

65+
- To generate a `lastSignInDateTime` timestamp, you need a successful sign-in. The value of the `lastSignInDateTime` property may be blank if:
66+
- The last successful sign-in of a user took place before April 2020.
67+
- The affected user account was never used for a successful sign-in.
68+
69+
- The last sign-in date is associated with the user object. The value is retained until the next sign-in of the user.
7670

77-
### What does a blank property value mean?
71+
## How to investigate a single user
7872

79-
To generate a lastSignInDateTime timestamp, you need a successful sign-in. Because the lastSignInDateTime property is a new feature, the value of the lastSignInDateTime property can be blank if:
73+
If you need to view the latest sign-in activity for a user you can view the user's sign-in details in Azure AD. You can also use the Microsoft Graph **users by name** scenario described in the [previous section](#detect-inactive-user-accounts-with-microsoft-graph).
8074

81-
- The last successful sign-in of a user took place before April 2020.
82-
- The affected user account was never used for a successful sign-in.
75+
1. Sign in to the [Azure portal](https://portal.azure.com).
76+
1. Go to **Azure AD** > **Users** > select a user from the list.
77+
1. In the **My Feed** area of the user's Overview, locate the **Sign-ins** tile.
8378

84-
### For how long is the last sign-in retained?
79+
![Screenshot of the user overview page with the sign-in activity tile highlighted.](media/howto-manage-inactive-user-accounts/last-sign-activity-tile.png)
8580

86-
The last sign-in date is associated with the user object. The value is retained until the next sign-in of the user.
81+
The last sign-in date and time shown on this tile may take up to 24 hours to update, which means the date and time may not be current. If you need to see the activity in near real time, select the **See all sign-ins** link on the **Sign-ins** tile to view all sign-in activity for that user.
8782

8883
## Next steps
8984

Loading

0 commit comments

Comments
 (0)