Skip to content

Unblock Microsoft 365 user sign-in

A Microsoft user can’t sign in and gets an error that the account is locked. You can unblock a Microsoft user sign-in, whether it was blocked automatically or intentionally. In this article, you will learn how to unblock a Microsoft 365 user account in Microsoft 365 admin center and with Microsoft Graph PowerShell.

Microsoft 365 user sign-in unblocked

Microsoft will automatically block a Microsoft 365 user sign-in if the user has entered the password incorrectly several times or if the account is inactive.

There are two ways to unblock a user sign-in:

  • Microsoft 365 admin center
  • Microsoft Graph PowerShell

Unblock user in Microsoft 365 admin center

First, we will show you how to unblock a single user account. Then we will show you the steps to unblock multiple users in the Microsoft 365 admin center.

Unblock single Microsoft 365 user sign-in

Time needed: 6 minutes

Unblock user sign-in Microsoft 365 admin center.

  1. Go to Microsoft 365 admin center.

    Sign in with your credentials

  2. Select the blocked user.

    Click Users > Active users
    Select the blocked user from the list

    Unblock sign-in Microsoft 365 user account

  3. The user pane opens.

    Click Unblock sign-in

    Unblock sign-in Microsoft 365 user account

  4. Unblock sign-in.

    Clear Block this user from signing in
    Click Save changes

    Unblock sign-in Microsoft 365 user account

  5. The user is now unblocked from signing in.

    Close the pane

    Unblock sign-in Microsoft 365 user account

Note: Remind the user to wait for 30 minutes before they can sign in to all Microsoft 365 services.

Unblock multiple Microsoft 365 users sign-in

To unblock multiple Microsoft 365 user accounts, follow the below steps.

First, we will find the unblocked users:

  1. Go to Users > Active users
  2. Click Filter > Sign-in blocked
  1. Select all the users in the list
  2. Click the More button
  3. Click Edit sign-in status
  1. Select Allow users to sign in (unblock)
  2. Click Save
Allow user to sign in (Unblock)
  1. Close the pane

The selected users are unblocked from signing in.

Unblocked multiple Microsoft 365 users

Note: The users should wait around 30 minutes to be able to sign in to all Microsoft services. Otherwise, the user will get an error 500 repeating redirects detected.

Unblock user with Microsoft Graph PowerShell

Another way to unblock a user sign-in account is with Microsoft Graph PowerShell. We will show you how to unblock a single sign-in account and multiple user sign-in accounts.

Note: You need to install Microsoft Graph PowerShell and then make sure to install the Microsoft Graph Beta module otherwise, the below script will not work.

Unblock single Microsoft 365 user sign-in

  1. Copy the below PowerShell script into PowerShell ISE or Visual Studio Code
  2. Change the user principal name (UPN) of the account you want to unblock on line number 6
  3. Run the below PowerShell script
# Connect to Microsoft Graph PowerShell
Connect-MgGraph -Scopes Directory.AccessAsUser.All

# Specify the user principal name (UPN) of the account you want to unblock
$upn = "amanda.hansen@m365info.com"

# Retrieve the user
$user = Get-MgBetaUser -Filter "UserPrincipalName eq '$upn'"

# Check if the user is blocked
if ($user.AccountEnabled -eq $false) {

    # User is blocked, unblock the account
    Update-MgBetaUser -UserId $User.Id -AccountEnabled:$true

    Write-Host "Account $($User.UserPrincipalName) unblocked successfully." -ForegroundColor Green
}
else {
    Write-Host "Account $($User.UserPrincipalName) is not blocked." -ForegroundColor Cyan
}

The output shows that the user account is unblocked.

Welcome To Microsoft Graph!
Account Amanda.Hansen@m365info.com unblocked successfully.

If a Microsoft 365 user account were unblocked, the output would show that the account is not blocked.

Welcome To Microsoft Graph!
Account Amanda.Hansen@m365info.com is not blocked.

Note: The users should wait around 30 minutes to be able to sign in to all Microsoft services. Otherwise, the user will get an error 500 repeating redirects detected.

Unblock multiple Microsoft 365 users

Follow the below steps to unblock multiple Microsoft 365 user sign-in with Microsoft Graph PowerShell.

  1. Create a .txt file and type the user accounts you want to unblock
  1. Go to the C:\temp folder
  2. Name the file
  3. Save it as a .txt file
  4. Click Save
  1. Run the below PowerShell script
# Connect to Microsoft Graph PowerShell
Connect-MgGraph -Scopes Directory.AccessAsUser.All

# Specify the path to the text file containing user principal names (UPNs)
$upns = Get-Content -Path "C:\temp\Users.txt"

# Loop through each UPN in the array
foreach ($upn in $upns) {
    # Retrieve the user
    $user = Get-MgBetaUser -Filter "UserPrincipalName eq '$upn'"

    if ($user) {
        # Check if the user is blocked
        if ($user.AccountEnabled -eq $false) {

            # User is blocked, unblock the account
            Update-MgBetaUser -UserId $user.Id -AccountEnabled:$true
            Write-Host "Account $($user.UserPrincipalName) unblocked successfully." -ForegroundColor Green
        }
        else {
            Write-Host "Account $($user.UserPrincipalName) is not blocked." -ForegroundColor Cyan
        }
    }
    else {
        Write-Host "Account $upn not found." -ForegroundColor Yellow
    }
}

The output unblocks the Microsoft 365 user accounts in the .txt file.

It can’t unblock user accounts if:

  • The user account was not blocked
  • The user account does not exist
Account Amanda.Hansen@m365info.com unblocked successfully.
Account Amanda.Kent@m365info.com not found.
Account Brenda.Smith@m365info.com unblocked successfully.
Account David.Kent@m365info.com is not blocked.
Account Stephen.Hunter@m365info.com unblocked successfully.

You successfully unblocked a Microsoft 365 user account!

Read more: Configure help desk information in Microsoft 365 »

Conclusion

You learned how to effectively unblock a single or multiple users sign-in account in Microsoft 365 admin center and with Microsoft Graph PowerShell. Remember that the user has to wait about 30 minutes before they can sign in to all Microsoft services again.

Did you enjoy this article? You may also like How to set Employee ID for Microsoft 365 users. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *