How to Log Out User Sessions in SharePoint Online?
Requirement: Force Log Off all sessions of a user, as he lost his mobile device, which is logged in with SharePoint Online sites.
How to sign out of SharePoint Online?
As an end-user, you can sign out from SharePoint by clicking on the User icon in the welcome menu and clicking on the “Sign out” link.
Once you are signed out, you’ll see a message “You’re signed out of Office 365”.
PowerShell to Log Out User from All Sessions in SharePoint Online
We can force log off a user from all his sessions opened with SharePoint Online using Revoke-SPUserSession cmdlet. Here is how:
#Connect to SharePoint Online
Connect-SPOService -URL https://crescent-admin.sharepoint.com -credential (Get-Credential)
#Logoff User
Revoke-SPOUserSession -User [email protected] -Confirm:$false
This prompts for credentials to connect to the SharePoint Online admin center, disconnects all sessions of a given user, and takes them to the login page.
You can also end the user sessions using PnP PowerShell:
Revoke-PnPUserSession -User [email protected]
This will sign out the user from everywhere, including browser, desktop, and mobile applications across all devices.