简体   繁体   English

如何使用图形API重置Office 365 Azure AD用户的密码?

[英]How To Reset Password Of Office 365 Azure AD User Using Graph API?

Graph API - We are trying to reset password of office 365 azure ad user, for that it acquires access token from azure ad using client credentials grant flow, in a daemon app\\service, but unable to reset password of user. Graph API-我们正在尝试重置Office 365天蓝色广告用户的密码,因为它使用守护程序app \\ service中的客户端凭据授予流从天蓝色广告中获取访问令牌,但无法重置用户密码。 It responds " Insufficient privileges to complete the operation ", I have given the following permission to applications. 它响应“ 权限不足,无法完成操作 ”,我已将以下权限授予应用程序。

1)User.ReadWrite.All - Read and write all users full profiles (Application + delegated permission) 2)Directory.AccessAsUser.All - Access directory as the signed-in user (Delegated permission) 1)User.ReadWrite.All-读写所有用户的完整配置文件(应用程序+委派权限)2)Directory.AccessAsUser.All-以登录用户身份访问目录(委派权限)

My O365 application is "multitenant Web Api" app which has been given an admin consent. 我的O365应用程序是“多租户Web Api”应用程序,已获得管理员同意。 The main purpose of my app is to sync users from my Web Application (User details etc.) to Azure AD. 我的应用程序的主要目的是将用户从Web应用程序(用户详细信息等)同步到Azure AD。 My application is able to sync all user profile details except the password. 我的应用程序能够同步除密码之外的所有用户个人资料详细信息。

Can a Daemon service application which has be authorized by the tenant administrator, reset the password of the users in the organization? 租户管理员授权的Daemon服务应用程序可以重设组织中用户的密码吗?

Thanks 谢谢

Currently Microsoft Graph (and AzureAD Graph) do not expose any application-only permissions (that could be used by a daemon app) to reset user passwords. 当前,Microsoft Graph(和AzureAD Graph)不公开任何仅应用程序权限(可以由守护程序使用)重置用户密码。 This is a particularly privileged operation that can easily be abused. 这是一种特别特权的操作,很容易被滥用。 We do support this operation, in an interactive delegated flow, using Directory.AccessAsUser.All , as long as the signed in user is an administrator. 只要登录用户是管理员,我们就使用Directory.AccessAsUser.All在交互式委托流中支持此操作。

If you need an application permission to reset passwords please request this on UserVoice: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis 如果您需要应用程序权限来重置密码,请在UserVoice上进行以下请求: https : //officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis

Hope this helps, 希望这可以帮助,

I had the same problem, it took 15 days to find a solution. 我遇到了同样的问题,花了15天的时间找到了解决方案。 Although the permissions are provided from the application it is not possible to reset the password of a user. 尽管权限是从应用程序提供的,但无法重置用户密码。 For this, a role of "Company Administrator" must be provided 为此,必须提供“公司管理员”角色

I followed the next steps and it worked: 我按照下面的步骤进行了工作:

  1. Run windows powershell as administrator 以管理员身份运行Windows Powershell

Write the next PowerShell cmdlets 编写下一个PowerShell cmdlet

  • Install-Module AzureAD 安装模块AzureAD
  • Connect-AzureAD 连接-AzureAD
  • $ app = Get-AzureADServicePrincipal -SearchString "AppName" $ app = Get-AzureADServicePrincipal -SearchString“ AppName”
  • $ role = Get-AzureADDirectoryRole | $角色= Get-AzureADDirectoryRole | Where-Object {$ _. 哪里对象{$ _。 DisplayName -eq "Company Administrator"} DisplayName -eq“公司管理员”}
  • Add-AzureADDirectoryRoleMember -ObjectId $ role.ObjectId -RefObjectId $ app.ObjectId Add-AzureADDirectoryRoleMember -ObjectId $ role.ObjectId -RefObjectId $ app.ObjectId

Note: Change "AppName" by the name of your application in AD. 注意:通过AD中的应用程序名称更改“ AppName”。 Connect to AzureAD with the user who has GlobalAdministrator permissions. 使用具有GlobalAdministrator权限的用户连接到AzureAD。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Graph API从Azure AD获取用户属性 - Get user properties from azure AD using Graph API 使用Java在Azure中访问Office 365(SharePoint REST API) - Access Office 365 (sharepoint REST api) in Azure using Java 如何使用 java 中的 Oauth 图形服务客户端 api 检索 Office 365 邮件文件(如图像、文本文件等)附件? - How to retrieve office 365 mail file (like image,text file etc) attachment using Oauth Graph Service Client api in java? 使用Graph API进行Azure AD导入适用于随机应用程序 - Azure AD Import using Graph API works for random applications 使用Azure AD Graph API时如何获取用于获取access_token的“代码” - how to get 'code' for getting access_token when using Azure AD Graph API 来自后端 Azure 广告的用户图形请求 - Graph request as User from backend Azure Ad 使用java通过microsoft graph访问office 365 planner - Using java to access office 365 planner via microsoft graph 如何在 Salesforce 应用程序中使用 RestAPI 重置用户密码? - How to reset user password using RestAPI in Salesforce application? 在Office 365 REST API中使用事件的扩展属性 - Using extended properties on Events in Office 365 REST API REST客户端示例使用Azure AD Graph API更新缩略图照片吗? - REST client sample to update thumbnail Photo using Azure AD Graph api?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM