How to auto delete inactive members?

Taen keren
Super Contributor


One thing that a member can leave a team - but how do I (prefer auto) clean up inactive users / orphaned users ?

5 Replies
+ 1 for access review



and if there's no license for 

  • Azure AD Premium P2
  • Enterprise Mobility + Security (EMS) E5 license


what then?

Hi Taen,

You could use Powershell to get a list of inactive users in Office 365


Others may have ideas of how you can get it directly through Powershell or by some other method. However, access review is optimal in terms of that's what it is designed for and in terms of monitoring access to specific applications it provides more granular management and better oversight. Adam is right here. The P2 licence is $9 per month US so this is a worthwhile investment to show what applications (including Teams) users are using, it identifies training needs quicker, distinguishes if someone has access to an application they shouldn't. It only needs to be given to the user who is performing the work.

Best, Chris

When do you consider a user inactive? When the user account is disabled or after x number of days without a sign-in? I can see that the price for P2 licenses can be high just for this function but you might find other features together with this worth the price.


Checking if the user is active with Get-MailboxStatistics is unreliable and also requires a user to have a mailbox.



Related Conversations