Reset a User's Password in Entra ID via Microsoft Graph

Prev Next

Issue a secure temporary password and force change at next sign-in for Entra ID users.

Complexity: Beginner. Impact: identity + security + helpdesk + user-lifecycle.

Why use this workflow

Password resets are one of the most common help desk tickets. When a user is locked out of their work account, IT needs a fast, auditable way to issue a temporary password and get them back to work while preserving security posture.

This workflow covers the end-to-end flow: verifying the user exists, generating a cryptographically secure temporary password, applying the reset through Microsoft Graph, and guiding the user through first sign-in. It also covers the common edge case where the target user holds a privileged role (Global Administrator, Privileged Authentication Administrator, and so on). In that case the standard passwordProfile PATCH is blocked and you must fall back to the Authentication Methods API.

When to use this workflow

  • A user reports they cannot sign in, and self-service password reset (SSPR) is not configured or not working.
  • A user's account was compromised and you want to force a credential rotation alongside session revocation.
  • An onboarding handoff where a temporary password must be communicated out-of-band.

Expected outcomes

  • You verified the target user account exists and is enabled in Entra ID.
  • You generated a cryptographically random temporary password.
  • You applied the password reset through Microsoft Graph with forceChangePasswordNextSignIn = true.
  • Optionally, you revoked existing sign-in sessions so the old credentials cannot be reused.
  • You communicated the temporary password to the user through a secure out-of-band channel.
  • An audit trail exists in the Entra ID sign-in and audit logs.

Risks and considerations

Security considerations

  • Never send the temporary password by email to the account you just reset. The user cannot read it. Use SMS, a secondary personal email on file, or a manager handoff.
  • Verify identity before resetting. Social engineering attacks frequently target the help desk. Confirm the requester through a second factor (a Teams video call, manager approval, or an ID check).
  • Privileged accounts are protected. If the target holds an admin role, a plain PATCH /users/{id} with a passwordProfile returns 403 Forbidden unless the caller holds Privileged Authentication Administrator. Use the Authentication Methods API (/authentication/passwordMethods/{id}/resetPassword) instead.
  • Hybrid-joined users: if the account is synced from on-premises AD, you must reset the password in on-premises AD. The Graph call fails with Unable to update the specified properties for on-premises mastered Directory Sync objects.
  • Always force change at next sign-in so that the admin-chosen password never persists as the user's working credential.
  • Revoke sessions (POST /users/{id}/revokeSignInSessions) if you suspect compromise. Otherwise existing refresh tokens remain valid.

Required permissions

PermissionWhy it's needed
User.ReadWrite.AllRequired to patch the passwordProfile on standard user accounts
UserAuthenticationMethod.ReadWrite.AllRequired to reset credentials on users who hold an admin role through the Authentication Methods API
Directory.AccessAsUser.AllRequired when acting on behalf of a signed-in admin for privileged operations
Privileged Authentication Administrator roleDirectory role required to reset passwords for users who hold admin roles

Ask Dex

Paste the prompt into a Dex conversation.

Prompt for IT admins

{user} can't sign in to their work account. Reset their password in Entra ID, force a password change at next sign-in, revoke existing sessions, and send the temporary password to {user}'s manager for secure handoff.

How an end user can ask Dex

I can't sign in to my work account. Please reset my password and tell me the next steps to regain access.

Manual steps (admin center)

  1. Go to the Microsoft Entra admin center > Identity > Users > All users.

  2. Search for the target user by display name or UPN (for example {user_upn}) and select their name to open the profile.

  3. On the user overview page, select Reset password in the command bar.

  4. In the flyout, review the user identity and select Reset password to confirm. Entra ID generates a temporary password and displays it once.

  5. Copy the temporary password immediately. It is not shown again after you close the pane.

  6. Deliver the temporary password to the user through a secure out-of-band channel (SMS to a verified mobile, a phone call, or their manager). Do not email it to the account you just reset.

  7. (Optional, recommended for suspected compromise) From the same user page, select Revoke sessions to invalidate existing refresh tokens.

  8. Tell the user that at next sign-in they are prompted to choose a new password that meets the tenant password policy, and they may need to re-register MFA if prompted.

If the user holds an admin role

You must be signed in as a Privileged Authentication Administrator or Global Administrator. Lower-privilege roles (User Administrator, Helpdesk Administrator) cannot reset passwords for admin-role holders and see the Reset password button greyed out.

Microsoft Graph API

Step 1: Look up the user and confirm they exist

GET https://graph.microsoft.com/v1.0/users/{user_upn}?$select=id,displayName,userPrincipalName,accountEnabled

Response:

{
  "id": "ecc4a3c2-4218-4e64-af61-f48be56f967c",
  "displayName": "{user_display_name}",
  "userPrincipalName": "{user_upn}",
  "accountEnabled": true
}

Step 2: Reset the password (standard users)

PATCH https://graph.microsoft.com/v1.0/users/{user_id}
Content-Type: application/json

{
  "passwordProfile": {
    "forceChangePasswordNextSignIn": true,
    "password": "{temporary_password}"
  }
}

A successful response is 204 No Content. Required scope: User.ReadWrite.All.

Step 3: Reset for admin-role holders (fallback)

If step 2 returns 403 Forbidden with Insufficient privileges, the target holds a protected role. Use the Authentication Methods API instead. First, list their password methods:

GET https://graph.microsoft.com/v1.0/users/{user_id}/authentication/passwordMethods

Then reset:

POST https://graph.microsoft.com/v1.0/users/{user_id}/authentication/passwordMethods/{password_method_id}/resetPassword
Content-Type: application/json

{
  "newPassword": "{temporary_password}"
}

Required scope: UserAuthenticationMethod.ReadWrite.All plus the Privileged Authentication Administrator directory role on the caller.

Step 4: (Optional) Revoke existing sessions

POST https://graph.microsoft.com/v1.0/users/{user_id}/revokeSignInSessions

Response: { "value": true }. This invalidates all refresh tokens so that the user must re-authenticate with the new password.

PowerShell

The Microsoft Graph PowerShell SDK provides cmdlets that wrap the Graph endpoints used above. Install and connect first:

# Install once (run elevated)
Install-Module Microsoft.Graph -Scope AllUsers

# Connect with the scopes this workflow needs
Connect-MgGraph -Scopes "User.ReadWrite.All", "UserAuthenticationMethod.ReadWrite.All"

Generate a secure temporary password

function New-TempPassword {
    param([int]$Length = 14)
    $chars = 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789!@#$%'
    -join (1..$Length | ForEach-Object { $chars[(Get-Random -Max $chars.Length)] })
}

Reset a standard user

$upn = "{user_upn}"
$temp = New-TempPassword
$profile = @{ forceChangePasswordNextSignIn = $true; password = $temp }

Update-MgUser -UserId $upn -PasswordProfile $profile
Write-Host "Temporary password: $temp" -ForegroundColor Yellow

Reset an admin-role user (Authentication Methods API)

$user = Get-MgUser -UserId $upn
$pwMethod = Get-MgUserAuthenticationPasswordMethod -UserId $user.Id | Select-Object -First 1

Reset-MgUserAuthenticationMethodPassword `
    -UserId $user.Id `
    -AuthenticationMethodId $pwMethod.Id `
    -NewPassword $temp

Revoke sessions (optional)

Revoke-MgUserSignInSession -UserId $user.Id