You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Graph API恢复已删除用户失败求助

恢复已删除用户时Graph API返回权限不足错误的排查

我尝试通过Graph API恢复已删除用户,按官方文档操作:

  • 创建Azure应用并添加User.ReadWrite.All应用权限,经全局管理员授权,生成的访问令牌中包含该权限
  • 发送POST请求 https://graph.microsoft.com/v1.0/directory/deletedItems/{user-id}/restore 时,返回权限不足错误:
{
  "error": {
    "code": "Authorization_RequestDenied",
    "message": "Insufficient privileges to complete the operation.",
    "innerError": {
      "date": "2024-05-20T06:55:15",
      "request-id": "43e68cc6-9b45-4625-8fcc-e88cb4353ce9",
      "client-request-id": "43e68cc6-9b45-4625-8fcc-e88cb4353ce9"
    }
  }
}

已做排查动作:

  • 添加Directory.ReadWrite.All权限后,错误依旧
  • 通过GET请求 https://graph.microsoft.com/v1.0/directory/deletedItems/{user-id} 确认已删除用户对象存在

请问操作中哪里出错?是否需要额外权限或请求头?

内容的提问来源于stack exchange,提问作者Yasitha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 18:49:55