Change Password for Azure AD using Microsoft Graph

前端 未结 2 1360
夕颜
夕颜 2021-01-20 07:07

I was planning to use Azure AD Graph API but then noticed on the Microsoft docs about suggestions to use Microsoft Graph API.

Is there a documentation provided for c

相关标签:
2条回答
  • 2021-01-20 07:43

    See here:

    https://blogs.msdn.microsoft.com/aaddevsup/2018/10/17/unable-to-modify-user-email-phone-number-password-or-other-personal-information-for-azure-active-directory-users/

    If you call this from an app/api, you'll need to assign an AD role to the serviceprincipal of the application.

    0 讨论(0)
  • 2021-01-20 07:44

    You could update passwordProfile property to change the current user's password . Please refer to below code :

    await graphClient.Me.Request().UpdateAsync(new User
    {
        PasswordProfile = new PasswordProfile
        {
            Password = "YourPassword",
                ForceChangePasswordNextSignIn = false
        },
    });
    

    And according to documentation, one of the following scopes is required to execute this API: User.ReadWrite User.ReadWrite.All Directory.ReadWrite.All.

    Edit: The documentation has been updated with the following note:

    When updating the passwordProfile property, the following scope is required: Directory.AccessAsUser.All.

    0 讨论(0)
提交回复
热议问题