Restore sign-in access for a locked-out user by diagnosing the cause, clearing it, and validating access.
Complexity: Beginner. Impact: user-management + identity + helpdesk + authentication + entra-id + microsoft-365.
Why use this workflow
Users in Entra ID can become unable to sign in for several distinct reasons that are all colloquially called "locked out":
- Smart lockout triggered by repeated bad password attempts: Entra ID temporarily blocks sign-ins from the offending source.
- Account disabled (
accountEnabled = false): often set by a lifecycle policy, HR offboarding automation, or a prior admin action. - Risky user state in Identity Protection: Entra has flagged the account and is blocking sign-ins until risk is remediated.
- Password expired or MFA registration incomplete.
This workflow covers the standard unlock flow an IT admin runs when a user (for example {user_upn}) calls the help desk saying they cannot sign in. It walks through diagnosing the lockout cause, clearing it, and confirming the user can sign in again.
Expected outcomes
- Identified the specific reason the user cannot sign in (smart lockout, disabled account, risk state, or expired credential).
- Re-enabled the account and/or dismissed the risky-user state as appropriate.
- Optionally reset the password or issued a Temporary Access Pass (TAP) if the user has forgotten their credentials.
- Revoked existing refresh tokens so stale sessions on compromised devices cannot be reused.
- Confirmed with the user that sign-in succeeds.
- An audit trail entry in the Entra audit log showing who performed the unlock and when.
Risks and considerations
Verify the requester's identity before unlocking. Account-unlock social engineering is a common help desk attack vector. Require a secondary verification channel (Teams video call, manager confirmation, or a pre-registered callback number) before clearing lockout or resetting a password.
- Do not dismiss risk without investigation. If Identity Protection flagged the user, check sign-in logs for suspicious IP addresses or impossible-travel events. Clearing risk blindly can leave an attacker with valid access.
- Revoke sessions after a password reset. A reset alone does not invalidate existing refresh tokens. Run a session revocation if there is any suspicion of compromise.
- Smart lockout clears on its own. There is no direct "unlock smart lockout" API. You reset the password or wait for the lockout to expire.
- Synced accounts (from on-premises Active Directory) must be unlocked in on-premises Active Directory, not in Entra. Check
onPremisesSyncEnabledfirst. - Privileged accounts (Global Administrator, Privileged Role Administrator) require extra scrutiny and should be unlocked by a second admin under the four-eyes principle.
Required permissions
| Permission | Why it's needed |
|---|---|
| User.ReadWrite.All | Required to update the accountEnabled property and reset passwords via Graph API. |
| UserAuthenticationMethod.ReadWrite.All | Required to issue a Temporary Access Pass or reset authentication methods. |
| IdentityRiskyUser.ReadWrite.All | Required to dismiss or confirm-safe a risky user flagged by Identity Protection. |
| AuditLog.Read.All | Required to inspect recent sign-in failures to diagnose the lockout cause. |
| Directory.AccessAsUser.All | Needed for delegated scenarios where the admin acts through the portal or Graph Explorer. |
Ask Dex
Paste the prompt into a Dex conversation.
Prompt for IT admins
{user} is locked out of Microsoft 365 and can't sign in. Investigate the cause (smart lockout, disabled account, risky-user state, or expired password), remediate appropriately, reset the password or issue a Temporary Access Pass if needed, revoke their existing sessions, and confirm sign-in is restored.
How an end user can ask Dex
I can't sign in to my Microsoft 365 account - it says my account is locked. Can you help me get back in?
Manual steps (admin center)
Step 1: Locate the user
- Sign in to the Microsoft Entra admin center as a User Administrator or higher.
- Go to Identity > Users > All users.
- Search for the user by UPN (for example
{user_upn}) and open their profile.
Step 2: Diagnose the cause
- On the user's overview page, check the Account enabled field. If it reads No, the account is disabled.
- Select Sign-in logs in the left pane of the user profile. Review the most recent failed sign-ins and note the Failure reason column. Common values include 50053 (account locked), 50057 (account disabled), 50055 (password expired), and 53003 (blocked by Conditional Access policy).
- Go to Protection > Identity Protection > Risky users and search for the user. If present with risk state At risk, Identity Protection is blocking sign-ins.
Step 3: Re-enable the account (if disabled)
- Return to the user profile and select Edit properties.
- Under the Settings section, set Account enabled to Yes.
- Select Save.
Step 4: Reset the password (if needed)
- On the user overview page, select Reset password.
- Entra generates a temporary password. Deliver it to the user through a verified out-of-band channel, not the mailbox they cannot access.
- Leave Require this user to change their password when they first sign in selected.
Step 5: Issue a Temporary Access Pass (preferred for passwordless users)
- From the user profile, go to Authentication methods > Add authentication method > Temporary Access Pass.
- Configure the duration and whether it is one-time use.
- Copy the TAP and deliver it through a verified channel.
Step 6: Dismiss risk (if flagged)
- Go to Protection > Identity Protection > Risky users.
- Select the user. Select Confirm user safe if you have verified the sign-in failures were legitimate. Otherwise select Confirm user compromised and follow your compromise playbook.
Step 7: Revoke sessions and confirm access
- On the user profile, select Revoke sessions. This invalidates all refresh tokens.
- Ask the user to sign in. Confirm success in the sign-in logs.
Microsoft Graph API
All examples use the v1.0 Graph endpoint. Replace {user-id} with the user's object ID or UPN.
1. Check the user's current state
GET https://graph.microsoft.com/v1.0/users/{user-id}?$select=id,userPrincipalName,accountEnabled,onPremisesSyncEnabled
Authorization: Bearer {token}If onPremisesSyncEnabled is true, stop. This user is mastered in on-premises Active Directory and must be unlocked there.
2. Review recent sign-in failures
GET https://graph.microsoft.com/v1.0/auditLogs/signIns?$filter=userPrincipalName eq '{upn}' and status/errorCode ne 0&$top=10&$orderby=createdDateTime desc3. Re-enable the account
PATCH https://graph.microsoft.com/v1.0/users/{user-id}
Content-Type: application/json
{
"accountEnabled": true
}Expected response: 204 No Content.
4. Reset the password
PATCH https://graph.microsoft.com/v1.0/users/{user-id}
Content-Type: application/json
{
"passwordProfile": {
"forceChangePasswordNextSignIn": true,
"password": "{temporary_password}"
}
}5. Issue a Temporary Access Pass
POST https://graph.microsoft.com/v1.0/users/{user-id}/authentication/temporaryAccessPassMethods
Content-Type: application/json
{
"lifetimeInMinutes": {lifetime_in_minutes},
"isUsableOnce": false
}The response body contains the temporaryAccessPass string. Capture it and deliver it securely.
6. Dismiss Identity Protection risk (if needed)
POST https://graph.microsoft.com/v1.0/identityProtection/riskyUsers/dismiss
Content-Type: application/json
{
"userIds": ["{user-id}"]
}7. Revoke all sign-in sessions
POST https://graph.microsoft.com/v1.0/users/{user-id}/revokeSignInSessionsThe response { "value": true } indicates all refresh tokens were invalidated.
PowerShell
The Microsoft Graph PowerShell SDK wraps the same Graph endpoints shown above. Install once with Install-Module Microsoft.Graph -Scope CurrentUser.
Connect with the right scopes
Connect-MgGraph -Scopes "User.ReadWrite.All","UserAuthenticationMethod.ReadWrite.All","IdentityRiskyUser.ReadWrite.All","AuditLog.Read.All"Inspect the user
$user = Get-MgUser -UserId "{user_upn}" -Property Id,UserPrincipalName,AccountEnabled,OnPremisesSyncEnabled
$user | Format-ListIf OnPremisesSyncEnabled is True, stop. The account is synced from on-premises Active Directory. Unlock it with Unlock-ADAccount on a domain controller instead.
Re-enable the account
Update-MgUser -UserId $user.Id -AccountEnabled:$trueReset password and force change at next sign-in
$tempPwd = "{temporary_password}" # generate randomly, never hardcode
Update-MgUser -UserId $user.Id -PasswordProfile @{
ForceChangePasswordNextSignIn = $true
Password = $tempPwd
}Issue a Temporary Access Pass
$tap = New-MgUserAuthenticationTemporaryAccessPassMethod -UserId $user.Id -LifetimeInMinutes {lifetime_in_minutes} -IsUsableOnce:$false
Write-Host "TAP: $($tap.TemporaryAccessPass)"Dismiss risk and revoke sessions
Invoke-MgDismissRiskyUser -UserIds @($user.Id)
Revoke-MgUserSignInSession -UserId $user.IdAll actions above are written to the Entra audit log with your admin identity as the actor.