An API that connects multiple Microsoft services, enabling data access and automation across platforms
Yes, you can reset specific users' passwords programmatically using Microsoft Graph. Here’s a general approach to do this:
- 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.Allpermission. - 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:
ReplacePOST https://graph.microsoft.com/v1.0/users/{userId}/authentication/passwordMethods/{passwordMethodId}/resetPassword Content-Type: application/json { "newPassword": "YourNewTemporaryPassword" }{userId}with the user's ID or user principal name and{passwordMethodId}with the ID of the password method you are targeting. - 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 - 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: