how to fix AAD issue "try again, that's not your current password"

Eaven HUANG 2,156 Reputation points
2023-07-17T03:18:04.5133333+00:00

Dear Experts,

we created AD users from on premises, sync them to the cloud then enabled SSPR and password writeback, MFA. Here is the scenario when using Powershell script:

User logs in with expired password (or recently changed temporary password) and is notified they have to change the password. On the next screen, the user is prompted to enter their old password, new password, and confirm password. User completes, but gets an error message ("Try again - that's not your current password."). Specifically, error code is 120000. No matter what the user does, the password does not work.

If I used AAD portal, find the user, click RESET Password, this works just expected. And here is my script:

# Connect to Azure AD
Connect-AzureAD

# Path to the CSV file
$csvPath = "C:\test.csv"

# Read the CSV file
$users = Import-Csv -Path $csvPath

# Iterate through each user in the CSV
foreach ($user in $users) {
    # Retrieve the user's email address and password from the CSV columns
    $email = $user.EmailAddress
    $newPassword = $user.NewPassword

    # Get the user's ObjectId by mapping their email address
    $userObj = Get-AzureADUser -Filter "userPrincipalName eq '$email'"
    $objectId = $userObj.ObjectId

    if ($objectId) {
        # Reset the user's password in Azure AD
        Set-AzureADUserPassword -ObjectId $objectId -Password (ConvertTo-SecureString -String $newPassword -AsPlainText -Force) -ForceChangePasswordNextLogin $True

        # Display the email and new password
        Write-Output "Password reset for user: $email"
        Write-Output "New password: $newPassword"
    } else {
        Write-Output "User with email address $email not found in Azure AD."
    }
}
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,273 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,366 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Walter Solano Vindas 0 Reputation points
    2024-04-11T11:43:25.53+00:00

    Was this resolved? I have the same problem


  2. WhatAmIDoingWrong 21 Reputation points
    2024-07-03T13:43:05.4+00:00

    This happened where I work, too.

    Although we weren't changing passwords using PowerShell, we found that when we change a user's password in Microsoft 365 Admin Center, the user gets the error "Try again--that's not your current password and Error Code: 120000" but if we change it using Microsoft Azure or Microsoft Entra Admin Center, it works just fine every time. We have tested this many times since this issue occurred.

    I hope this helps someone out there who has also experienced the wrath of (understandably) frustrated users who encounter this error.

    0 comments No comments