Does azure AD support password change of on-premise AD users(on premise AD synced with azure AD) through graph apis without asking the user to change the password On next logon?

Pranay Bhatia 20 Reputation points
2023-02-19T06:47:43.7133333+00:00

Use case - azure ad is synced with on prem ad via azure ad connect

Password rightback is enabled for the same

How should I do the password change of an on prem ad user using graph apis?

for reference I was following these documents for password change of on prem ad user synced with azure ad

https://learn.microsoft.com/en-us/graph/api/authenticationmethod-resetpassword

https://learn.microsoft.com/en-us/azure/active-directory/authentication/concept-sspr-writeback

When I am trying to hit /reset password api , its shows access denied- user is not allowed to use this resource.

Also, i am using service principal in this process, which has authentication administrator and global administrator rights

No sufficient documentation is available for the above use case?

If the above use case is achievable- request the team to share a sample documentation for graph apis token generation and password change /reset process ?

Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

Accepted answer
  1. Akshay-MSFT 17,956 Reputation points Microsoft Employee Moderator
    2023-02-24T10:53:05.3666667+00:00

    @Pranay Bhatia

    PFB the steps we followed to run this:

    Set the appropriate permissions in Active Users and Computers for the account that is used by Azure AD Connect

    • Resetting On-Prem Password policy.
    • Get Access Token by running Auth Code Grant via Postman :

    User's image

    • Fetching the access token after logging in with Password administrator account.
    • As mentioned in the documentation, currently reset password is only supported with delegated permissions scope. Also, only an administrator with the appropriate permissions can perform this operation and it cannot be performed on a user's own account. Please note that UserAuthenticationMethod.ReadWrite.All delegated permissions must be granted for the APP that is registered in Azure AD. As you can see below, I have tested this reset password API in Postman API tool using delegated scope and the succesful response is being generated. You can also refer Calling Graph API from Azure Logic Apps using delegated permissions documentation for more information. 168553-image.png
       POST https://graph.microsoft.com/beta/users/{id | userPrincipalName}/authentication/passwordMethods/{id}/resetPassword  
    

    Important Note : APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. Example Output in Postman API tool: 168530-ms-graph-users-api-password-reset.jpg

    • The password request went successful.
    • Kindly wait for an hour for on-prem changes to replicate and try logging in with new password.

    Thanks,

    Akshay Kaushik

    Please "Accept the answer" (Yes/No), and share your feedback if the suggestion works as per your business need. This will help us and others in the community as well.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Thameur-BOURBITA 36,261 Reputation points Moderator
    2023-02-19T09:57:00.74+00:00

    Hi @Pranay Bhatia

    If writeback is enabled , in this case reset passowrd through Microsoft Graph API is not supported as mentioned in the Microsoft article below :

    Unsupported writeback operations

    User's image

    Please don't forget to mark helpful answer as accepted

    0 comments No comments

  2. Givary-MSFT 35,626 Reputation points Microsoft Employee Moderator
    2023-03-03T07:24:41.5966667+00:00

    @Pranay Bhatia Thank you for reaching out to us and providing the detailed description of the issue,

    Regarding your ask - Does Azure AD support password change of on-premises AD users(on premise AD synced with azure AD) through graph API without asking the user to change the password On next logon?   

    Researched on the same, refer to this article - authenticationMethod: resetPassword - Microsoft Graph v1.0 | Microsoft Learn which has the steps on how to achieve. 

    Reference:

    Update-MgGraph new passwords not writing back - Microsoft Q&A

    Error while updating the password profile - Microsoft Q&A

    Let me know if you have any further questions, feel free to post back.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.