When to use Revoke-MgUserSignInSession and when to use Revoke-SPOUserSession? I also read an articlet Revoke-SPOUserSession is expired.

Viswanathan, Srikrishna 0 Reputation points
2026-10-30T08:23:22.1333333+00:00

When to use Revoke-MgUserSignInSession and when to use Revoke-SPOUserSession? I also read an articlet Revoke-SPOUserSession is expired.

Microsoft 365 and Office | SharePoint | Development
0 comments No comments

2 answers

Sort by: Oldest
  1. AI answer

    2026-10-30T08:24:17.4233333+00:00

    Use Revoke-MgUserSignInSession for normal Microsoft Entra/Microsoft 365 session revocation; use Revoke-SPOUserSession only when specifically administering sessions through SharePoint Online PowerShell and its stricter prerequisites are acceptable.

    Key differences

    Cmdlet Use it when Important behavior and limitations
    Revoke-MgUserSignInSession Revoking a user’s Microsoft Entra sign-in sessions across applications, such as after a lost device, suspected compromise, or administrative sign-out Invalidates all refresh tokens issued to applications for the user and Entra browser session cookies by resetting signInSessionsValidFromDateTime. Supports work/school accounts, including delegated or application authentication with an accepted Graph permission. Personal Microsoft accounts are unsupported. ^1^
    Revoke-SPOUserSession Performing the older, SharePoint Online PowerShell-based administrative operation for a tenant user Signs the user out of browser, desktop, and mobile applications accessing Microsoft 365 resources across devices. It requires a Connect-SPOService context and Global Administrator; it does not apply to guest users. Completion can be immediate or take up to one hour, and the feature can be disabled for a tenant. ^2^

    For new automation and general Entra session revocation, Microsoft’s current access-revocation procedure uses Revoke-MgUserSignInSession. ^3^

    Connect using an accepted permission—User.RevokeSessions.All is the least-privileged permission listed specifically for this operation—and then revoke the target user’s sessions:

    Import-Module Microsoft.Graph.Users.Actions
    
    Connect-MgGraph -Scopes "User.RevokeSessions.All"
    
    # A user object ID or UPN can be supplied.
    Revoke-MgUserSignInSession `
        -UserId "[Email]" `
        -Confirm:$false
    

    The result is a Boolean. The user must authenticate again when an application next requires Entra authentication.

    For an account compromise or employee termination, session revocation alone is not the complete offboarding action. Microsoft’s procedure also disables the account and, where appropriate, disables registered devices. ^3^

    When the SPO command is still appropriate

    If existing SharePoint Online administration already depends on the SPO Management Shell, it can still be run as follows:

    Connect-SPOService `
        -Url "https://contoso-admin.sharepoint.com"
    
    Revoke-SPOUserSession `
        -User "[Email]" `
        -Confirm:$false
    

    Use it only when:

    • the target is a tenant member, not a guest;
    • the operator is a Global Administrator;
    • an SPO service connection is established; and
    • the possible delay of up to one hour is acceptable.

    The current Microsoft reference still documents Revoke-SPOUserSession and does not mark it as deprecated or expired. “It can take up to an hour” describes revocation propagation, not the command expiring. A result saying that the cmdlet “isn’t ready for use in your organization yet” means it has been disabled for that tenant, not globally retired. ^2^

    Revocation is not always an instantaneous global logout

    Neither command guarantees that every application window immediately closes:

    • Existing access tokens can remain usable until they expire; Microsoft documents a typical one-hour lifetime.
    • An application can issue and control its own session cookie. Microsoft Entra cannot directly revoke an application-owned session token.
    • The effective sign-out time therefore depends on how the application validates access, whether it supports Continuous Access Evaluation, and when it returns to Entra for reevaluation. ^3^

    Consequently, do not run both cmdlets routinely: use the Graph cmdlet for general Entra/Microsoft 365 revocation, retaining the SPO cmdlet only for a specific existing SharePoint Online operational requirement.


    References

    1. Revoke-MgUserSignInSession-Syntax
    2. Revoke-SPOUserSession-Syntax
    3. Revoke user access in Microsoft Entra ID
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

  2. Hin Vo 1,745 Reputation points Independent Advisor
    2026-10-30T08:47:43.3733333+00:00

    Hi @Viswanathan, Srikrishna

    As far as I know, both of these cmdlets are used to invalidate user sessions, but they have different scopes.

    Revoke-SPOUserSession was primarily designed to invalidate a user's SharePoint Online and OneDrive sessions within a more limited scope.

    User's image

    Reference: Revoke-SPOUserSession

    In contrast, Revoke-MgUserSignInSession revokes the user's refresh tokens and signs them out across Microsoft 365 services, rather than being limited to SharePoint Online.

    User's image

    Reference: Revoke-MgUserSignInSession

    Therefore, it appears that Revoke-MgUserSignInSession is the more effective and comprehensive option when the goal is to force a user to reauthenticate across their Microsoft 365 environment, rather than signing them out of only a specific workload.User's imageYou can refer more via: Microsoft Retires the Revoke-SPOUserSession Cmdlet

    I hope this helps.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.