如何通过Graph Api获取所有用户重置密码所需的认证方法数量
获取用户密码重置认证方法的Graph API方案
- 使用用户认证方法列表接口获取目标数据,接口路径:
GET /users/{id | userPrincipalName}/authentication/methods
该接口返回用户已注册的所有认证方法,其中包含密码重置可用的类型(如短信、邮件、Microsoft Authenticator应用等)。 - 若需精准筛选仅密码重置相关的方法,可添加
$filter参数:GET /users/{id | userPrincipalName}/authentication/methods?$filter=methodCategory eq 'passwordReset' - 权限要求:需配置
UserAuthenticationMethod.Read(单用户读取)或UserAuthenticationMethod.Read.All(批量用户读取)权限,可通过Azure AD门户为应用/委派身份授予对应权限并完成同意流程。 - 示例请求(可在Graph Explorer中直接测试):
GET https://graph.microsoft.com/v1.0/users/your-user-principal-name@domain.com/authentication/methods?$filter=methodCategory eq 'passwordReset'
返回结果会直接对应你截图中「password reset -> Authentication methods」下的已配置方法列表。
内容的提问来源于stack exchange,提问作者Igor
相关产品推荐
相关产品推荐

