Force logoff of Office 365, OneDrive, and Sharepoint Online
There are situations you will want to be able to force a logout of a user from Microsoft Office 365 services. Two common situations are when a user is terminated or an account has been compromised. First you should either disable the account if the user is leaving the company or change the password in the case of a compromised account. Next you can use the GUI or PowerShell to initiate a sign-out from the cloud services.
Using the GUI:
- Open the Microsoft 365 Admin Center.
- Under Users select Active Users.
- Next click on the desired user. Select the OneDrive tab and click the link to Initiate sign-out.
- Open PowerShell as Administrator.
- Connect to Azure AD with the following command:
- Run the following command to sign-out the user of all active sessions.
Get-AzureADUser -SearchString email@example.com | Revoke-AzureADUserAllRefreshToken