Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Graph Api-Change Password

I have created Users in Azure AD and with the help of Microsoft graph api trying to change the password of users but getting error message as admin rights required. Help is appreciated

like image 718
sql Avatar asked Sep 14 '25 15:09

sql


2 Answers

   {
   "passwordProfile": {
                "forceChangePasswordNextSignIn": false,
                "password": "newPassword"
            }
    }

Try doing a patch and changed the attribute. This also worked for me in the past.

like image 63
Achraf C. Avatar answered Sep 17 '25 18:09

Achraf C.


I'm not sure which api you are using , Azure AD Graph API or Microsoft Graph api . But no mater which api , the change password operation is used for the signed-in user to change their own password :

microsoft graph api :

POST https://graph.microsoft.com/v1.0/me/changePassword
Content-Type: application/json
{
  "currentPassword": "Test1234!",
  "newPassword": "Test5678!"
}

Azure AD Graph api :

POST https://graph.windows.net/me/changePassword?api-version=1.6
Content-Type: application/json
{
  "currentPassword": "138122cC@",
  "newPassword": "138122c@"
}

Please refer to document : https://msdn.microsoft.com/Library/Azure/Ad/Graph/api/functions-and-actions#changePassword

Note: This action can only be called on the signed-in user. In addition to addressing the operation by using the me alias as shown below, you can use /users//changePassword or /users/userPrincipalName/changePassword, but if you use these addressing modes, the target user must be the signed-in user.

If target user isn't the signed-in user , it will throw error :Access to change password operation is denied.

like image 31
Nan Yu Avatar answered Sep 17 '25 19:09

Nan Yu