使用MicrosoftGraph更改AzureAD的密码我打算使用AzureADGraphAPI,但后来注意到Microsoft文档中建议使用MicrosoftGraphAPI。是否有更改用户密码的文档?stringresult=Task.Run(async()=>{returnawaitGetAccessToken();}).GetAwaiter().GetResult();vargraphserviceClient=newGraphServiceClient(newDelegateAuthenticationProvider((requestMessage)=>{requestMessage.Headers.Authorization=newAuthenticationHeaderValue("bearer",result);returnTask.FromResult(0);}));varchangePasswordRequest=graphserviceClient.Me.ChangePassword("oldpassword","newpassword");但我认为这还不够。有可用的文件吗?您可以更新passwordProfile属性以更改当前用户的密码。请参考以下代码:awaitgraphClient.Me.Request().UpdateAsync(newUser{PasswordProfile=newPasswordProfile{Password="YourPassword",ForceChangePasswordNextSignIn=false},});根据文档,执行此API需要以下范围之一:User.ReadWriteUser.ReadWrite.AllDirectory.ReadWrite.All。编辑:文档已更新为以下注释:更新passwordProfile属性时,需要以下范围:Directory.AccessAsUser.All。以上就是C#学习教程:使用MicrosoftGraph更改AzureAD的密码分享全部内容。如果对你有用,需要进一步了解C#学习教程,希望大家多多关注。本文收集自网络,不代表立场。涉及侵权,请点击维权联系管理员删除。如需转载请注明出处:
