Skip to main content

How to Block Sign-In for a User in Microsoft 365

· 9 min read
Jagdish Kumawat
Founder @ Dewiride

When someone leaves, the first thing to do with their account is stop it being used. Block sign-in does exactly that: nobody can sign in as the person, and their mailbox, files and data stay where they are. This guide blocks a leaver in the Microsoft 365 admin center, shows what he sees when he tries to sign in, and does the same with PowerShell.

What Blocking Does​

The Block sign-in pane sums it up: blocking prevents anyone from signing in as the user and stops new sign-ins for the account. If the person is signed in, they're signed out of all Microsoft services within 60 minutes. Blocking doesn't stop the account receiving mail, and it doesn't delete any data.

Microsoft's offboarding article, Step 1 - Prevent user sign-in and block access to Microsoft 365, is more cautious about timing: it says a block can take up to 24 hours to take effect. To stop someone straight away, it resets their password and signs them out of all sessions before blocking them. That order matters in the admin center, as Step 2 explains.

Blocking is also what apps see. It turns off the account's Account enabled setting, which the Microsoft Entra admin center shows as Account status: Disabled.

Prerequisites​

  • An admin role that can manage users. Microsoft's article names User Administrator or Helpdesk Administrator for standard users; signing out other administrators needs Global Administrator.
  • The person who's leaving. The example is Leo Martin, a Sales Engineer in the demo company of the Career Development Plan series, who leaves in Part 10.

Step 1: Open Active Users​

In the Microsoft 365 admin center, go to Users → Active users and find the person. Select their name, here Leo Martin:

The Active users page in the Microsoft 365 admin center listing Aisha Khan, Daniel Brooks, Admin User, Leo Martin and Olivia Bennett with their example.com usernames and licenses, and Leo Martin outlined in red

In a long list, use Search active users list at the right of the command bar. The search box at the top of the page searches the whole admin center instead: I typed into it by mistake, and it opened a separate search results page.

Step 2: Select Block Sign-In​

The person's details open with Reset password, Block sign-in and Delete user under their name. Select Block sign-in:

Leo Martin's details pane with Reset password, Block sign-in outlined in red, and Delete user, and the Account tab showing a Sign-out section with Sign out of all sessions

Notice the Sign-out section on the Account tab. If the person might be signed in, select Sign out of all sessions now, before blocking, as Microsoft's article does. Once the user is blocked, the admin center no longer shows that section. I blocked first, and signed Leo out from Microsoft Entra afterwards (Fixed: "Sign Out of All Sessions" Missing After Blocking a User).

Step 3: Block the User​

The Block sign-in pane explains what will happen. Tick Block this user from signing in, then select Save changes:

The Block sign-in pane for leo.martin@example.com explaining that blocking prevents anyone from signing in as this user, with Block this user from signing in ticked and outlined in red, and the Save changes button

Step 4: Check the Result​

The pane confirms it: Leo Martin is now blocked from signing in. They'll automatically be signed out of all Microsoft services within 60 minutes.

The Block sign-in pane with a green confirmation reading Leo Martin is now blocked from signing in. They'll automatically be signed out of all Microsoft services within 60 minutes.

Back on the person's details, Sign-in blocked appears under their name, and Block sign-in has become Unblock sign-in, which reverses it:

Leo Martin's details with Sign-in blocked outlined in red under his name, and Reset password, Unblock sign-in and Delete user

What the Person Sees​

About an hour after the block, Leo tried to sign in. After his password, Microsoft refused:

The Microsoft sign-in page for leo.martin@example.com reading Enter password, with the error Your account has been locked. Contact your support person to unlock it, then try again.

Your account has been locked. Contact your support person to unlock it, then try again. His data was untouched. In the Career Development Plan app, he dropped off his manager's team the next time the manager opened it (Part 10).

Sign Them Out After a Block​

If you've already blocked someone, the Account tab no longer offers Sign out of all sessions. Use Revoke sessions on their Overview page in the Microsoft Entra admin center. Microsoft's article Revoke user access in Microsoft Entra ID does it in that order: disable the account, then revoke sessions. The fixes post has the steps and screenshots.

Do It with PowerShell​

Every command here was run for this guide, and the output is real, with the address masked. I ran it after blocking Leo in the admin center, so it changed nothing: Update-MgUser doesn't complain when the account is already blocked.

Install the module​

The commands are in the Microsoft.Graph.Users module. Install it as shown in How to Set a User's Manager and Job Title.

Sign in​

PowerShell
Connect-MgGraph -Scopes "User.ReadWrite.All" -UseDeviceCode -ContextScope Process -NoWelcome
  • User.ReadWrite.All is the permission Microsoft's article Block Microsoft 365 user accounts with PowerShell uses for blocking and unblocking.
  • -UseDeviceCode prints a code instead of opening a browser. Open https://login.microsoft.com/device in any browser, enter the code and sign in as an admin.
  • -ContextScope Process keeps the sign-in for this PowerShell window only, instead of saving it for later sessions.

Block the user​

PowerShell
$params = @{ accountEnabled = $false }
Update-MgUser -UserId "leo.martin@example.com" -BodyParameter $params

accountEnabled = $false is the same switch the admin center turns off. -UserId takes the person's sign-in name. Update-MgUser prints nothing when it works. Microsoft's article unblocks with the same command and $true.

Check it​

PowerShell
Get-MgUser -UserId "leo.martin@example.com" -Property DisplayName,UserPrincipalName,AccountEnabled |
Select-Object DisplayName, UserPrincipalName, AccountEnabled | Format-List
Output
DisplayName : Leo Martin
UserPrincipalName : leo.martin@example.com
AccountEnabled : False

List everyone who's blocked​

PowerShell
Get-MgUser -Filter "accountEnabled eq false" -Property DisplayName,AccountEnabled |
Select-Object DisplayName, AccountEnabled | Format-Table
Output
DisplayName AccountEnabled
----------- --------------
Leo Martin False

-Filter asks Microsoft Graph for blocked accounts only, so the list stays short in a large organization.

When you're done, sign out:

PowerShell
Disconnect-MgGraph

Common Mistakes​

MistakeWhat happensDo this instead
Blocking before signing the person outThe admin center no longer offers Sign out of all sessionsSign out first, or use Revoke sessions in Microsoft Entra
Deleting the account straight awayA deleted user can only be restored for 30 daysBlock first; delete once their work is handed over
Expecting the block to free the licenseThe license stays assigned to the accountRemove the license, or delete the user when you're ready

Troubleshooting​

SymptomLikely causeFix
The person can still use something after the blockSigned-in sessions get up to 60 minutes; Microsoft allows up to 24 hours for the blockReset their password and revoke their sessions
Sign out of all sessions is missingThe user is already blockedUse Revoke sessions in Microsoft Entra
Typing a name opens a search results pageYou used the admin center's search boxUse Search active users list

FAQ​

Does blocking delete anything?​

No. The pane says so, and Leo's account, group membership and license were all still there afterwards.

Can the person still receive email?​

Yes. The pane says blocking doesn't stop the account receiving mail. Microsoft's offboarding articles cover what to do with a leaver's mailbox.

How do I undo it?​

Select Unblock sign-in on the person's details, or run the PowerShell command with accountEnabled = $true.

Does blocking free the license?​

No. As How to Add a User and Assign a License explains, the license is freed when you delete the user or remove it from them.

Conclusion​

To stop a leaver's access: sign them out, then select Block sign-in, tick Block this user from signing in and save. The account stays intact and can't be used, and apps that check Account enabled stop listing the person. In PowerShell, it's one Update-MgUser with accountEnabled = $false.

Additional Resources​

Stay Updated

Subscribe to our newsletter for the latest tutorials, tech insights, and developer news.

By subscribing, you agree to our privacy policy. Unsubscribe at any time.