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

Microsoft Flow调用Graph API分配用户许可证遇405错误求助

问题排查与解决方案

核心问题分析

  • HTTP方法错误:Microsoft Graph API中,为用户分配/更新许可证的正确HTTP方法是PUT,而非你当前使用的POST。/users/{id}/assignedLicenses端点仅支持PUT操作来修改用户的许可证分配。
  • 请求体无效数据:你的addLicenses数组中包含一个skuId为空的条目,这属于无效的许可证参数,会导致请求被拒绝。

修正后的请求示例

请求输入(已修正)

{
    "uri": "https://graph.microsoft.com/v1.0/users/67a9cbf3-d55b-47b3-b0d2-be1ba01f683d/assignedLicenses",
    "method": "PUT",
    "authentication": {
        "authority": "https://login.microsoftonline.com",
        "tenant": "Tenant ID",
        "audience": "https://graph.microsoft.com",
        "clientId": "Secret ID",
        "secret": "*sanitized*",
        "type": "ActiveDirectoryOAuth"
    },
    "body": {
        "addLicenses": [
            {
                "disabledPlans": [],
                "skuId": "f30db892-07e9-47e9-837c-80727f46fd3d"
            }
        ],
        "removeLicenses": []
    }
}

额外验证点

  • 确认skuId对应的许可证在你的租户中可用,且有剩余配额。
  • 确保应用已正确授予User.ReadWrite.All或Directory.ReadWrite.All权限,且权限已被管理员同意(委派权限需要用户登录,应用权限需要管理员同意)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 04:09:52