|
1 | 1 | ---
|
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 |
4 | 4 | services: active-directory
|
5 | 5 | author: shlipsey3
|
6 | 6 | manager: amycolannino
|
7 | 7 | ms.service: active-directory
|
8 | 8 | ms.topic: how-to
|
9 | 9 | ms.workload: identity
|
10 | 10 | ms.subservice: report-monitor
|
11 |
| -ms.date: 10/31/2022 |
| 11 | +ms.date: 04/05/2023 |
12 | 12 | ms.author: sarahlipsey
|
13 | 13 | ms.reviewer: besiler
|
14 | 14 |
|
15 | 15 | ms.collection: M365-identity-device-management
|
16 | 16 | ---
|
17 |
| -# How To: Manage inactive user accounts in Azure AD |
| 17 | +# How To: Manage inactive user accounts |
18 | 18 |
|
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. |
20 | 20 |
|
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). |
22 | 22 |
|
23 | 23 | ## What are inactive user accounts?
|
24 | 24 |
|
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. |
26 | 26 |
|
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. |
28 | 28 |
|
29 | 29 | 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.
|
30 | 30 |
|
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> |
33 | 33 |
|
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: |
35 | 35 |
|
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` |
37 | 38 |
|
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` |
39 | 41 |
|
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` |
42 | 44 |
|
43 | 45 | > [!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*. |
54 | 47 |
|
55 |
| -### Is the lastSignInDateTime property available through the Get-AzureAdUser cmdlet? |
| 48 | +### What you need to know |
56 | 49 |
|
57 |
| -No. |
| 50 | +The following details relate to the `lastSignInDateTime` property. |
58 | 51 |
|
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). |
60 | 53 |
|
61 |
| -To access this property, you need an Azure Active Directory Premium edition. |
| 54 | +- The property is *not* available through the Get-AzureAdUser cmdlet. |
62 | 55 |
|
63 |
| -### What permission do I need to read the property? |
| 56 | +- To access the property, you need an Azure Active Directory Premium edition license. |
64 | 57 |
|
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 |
66 | 62 |
|
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. |
75 | 64 |
|
| 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. |
76 | 70 |
|
77 |
| -### What does a blank property value mean? |
| 71 | +## How to investigate a single user |
78 | 72 |
|
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). |
80 | 74 |
|
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. |
83 | 78 |
|
84 |
| -### For how long is the last sign-in retained? |
| 79 | +  |
85 | 80 |
|
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. |
87 | 82 |
|
88 | 83 | ## Next steps
|
89 | 84 |
|
|
0 commit comments