top of page
Writer's pictureKasper Larsen

Disabled or inactive User Accounts in M365 - a prerequisite for Governance

Among the many "triggers" in SharePoint Online these are the ones with the greatest impact:

  • Content created


  • Content updated


  • User Account disabled


Today we are looking at the latter and how to detect that a User Account no longer is active, as this is the primary trigger for a lot of governance actions.





You might expect that a key property of a User Account such as if it is active should be pretty obvious, but it is NOT. (unless HR remembers to inform you)

The fellowing approaches to detecting disabled or inactive user account is available as a PnP Script Samples PowerShell script 😊


First of all, what do we mean by "User Account"?


  • Are we defining this as a User Profile in the SharePoint User Profile Application (UPA)?

  • Are we talking about the Users endpoint in Microsoft Graph?


The answer is YES, as both can be used to decide if the User Account is active.


HideFromAddressLists


In the UPA we have the SPS-HideFromAddressLists property which, as the name implies, is used to hide the account from a address list. This property is synchronized into the UPA and originates in Exchange and is used to exclude the account from the Global Address List (GAL).

Once the SPS-HideFromAddressLists property changes to true, it is very often a good indicator that the User Account has been disabled.

In Microsoft Search this property is the only way to exclude accounts from being shown.


Customer AD Properties


Another option is that the organization have added a customer User Profile Property like "EmployeeStatus"/"UserDisabled" and this property is sync'ed from AD/AAD to SharePoint via a customer sync job.

I have even seen an organization where the UserAccountName was prefixed with ZZ[YearOfLeaving] as a way to tag the user as disabled 😮

Please consult your friendly Entra ID admin for details if the organization is using this approach.


Graph 😃

Using Graph we can query the Users endpoint to get the accountEnabled property





However, you will have to check with the Entra ID team in your organization to verify when Accounts gets disabled and if it is a good indicator that the employee no longer is with the Organization.

Perhaps you will have to check if another criterium is fulfilled, like no licenses assigned, in order to determine that the user has been off-boarded.


No Activity

Yet another way to query if the user is inactive is to use the Auditlogs in Graph to check if the user has been active within the last X days.


https://graph.microsoft.com/v1.0/auditLogs/signIns?$top=1&$filter=userPrincipalName eq 'LeeG@tcwlv.onmicrosoft.com'


The absence of logins is not a bullet proof way to detect that the user no longer is with the Organization, but it is a pretty good indicator.

Summary

The above should make it clear that we most likely will have to test a number of criteria in order to determine if we should start the governance actions, like rerouting the workflows assigned to the user in question, reassign ownerships on assets and so on.


The list of criteria will probably vary from organization to organization, but using the right mix should give you a good chance to detect those users.




Recent Posts

See All

Microsoft Archiving- searchable or not?

Announcements from Microsoft have contained mixed signals whether content in the Microsoft Archiving service will be searchable for end...

Comments


bottom of page