Reset users password programatically

Vitor 0 Reputation points
2025-12-12T15:48:55.45+00:00

Hi,

I would like to know if there's any way to reset specific users passwords programatically, probably via Microsoft Graph.

I've tried to use application registrations, roles and administrative units, but without success. Any tips to implement this? Is this even possible?

<Moved from Office/Access>

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-12-12T15:49:07.6033333+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Yes, you can reset specific users' passwords programmatically using Microsoft Graph. Here’s a general approach to do this:

    1. Set Up Application Registration: Ensure you have an application registered in Azure AD with the necessary permissions to reset passwords. You will need the User.ReadWrite.All permission.
    2. Use Microsoft Graph API: You can reset a user's password by sending a POST request to the appropriate endpoint. Here’s an example of how to reset a user's password and specify a temporary password:
         POST https://graph.microsoft.com/v1.0/users/{userId}/authentication/passwordMethods/{passwordMethodId}/resetPassword
         Content-Type: application/json
         
         {
             "newPassword": "YourNewTemporaryPassword"
         }
      
      Replace {userId} with the user's ID or user principal name and {passwordMethodId} with the ID of the password method you are targeting.
    3. Let Microsoft Entra ID Generate a Password: If you prefer to let Microsoft Entra ID generate a temporary password, you can send a POST request without specifying a new password:
         POST https://graph.microsoft.com/v1.0/users/{userId}/authentication/passwordMethods/{passwordMethodId}/resetPassword
      
    4. Check the Status: After initiating the password reset, you can check the status of the operation using the provided URL in the response.

    Make sure to handle the necessary authentication and authorization steps in your application to successfully call the Microsoft Graph API.


    References:

    0 comments No comments

Your answer

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