gpt4 book ai didi

azure - 尝试向用户添加架构扩展时权限不足

转载 作者:行者123 更新时间:2023-12-02 00:52:27 25 4
gpt4 key购买 nike

我正在尝试使用graph.microsoft.com向用户对象添加自定义属性。我为此选择了架构扩展,但对 https://graph.microsoft.com/v1.0/schemaExtensions 的 POST 请求返回 Authorization_RequestDenied

首先,我通过 Azure CLI 检查了权限(id 是我的应用 ID):

az ad app permission list-grants --id 229e9b3d-5a17-4a46-930a-60e8ca114027 --show-resource-name

对于 Microsoft Graph,有很多权限,但据我了解,我应该只需要 User.ReadWrite.AllDirectory.AccessAsUser.All 。 。

然后我使用 Insomnia(在没有编码问题的情况下检查功能)并使用 JSON 正文调用 POST https://graph.microsoft.com/v1.0/schemaExtensions:

{
"id": "extTest",
"description": "test extension",
"targetTypes": [
"User"
],
"properties": [
{
"name" : "isAvailable",
"type" : "Boolean"
}
]
}

返回的响应是:

{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "d5c1e7b3-f1c5-44c0-917d-5e43d7483bdf",
"date": "2019-06-10T13:44:36"
}
}
}

有什么我错过的吗?

最佳答案

您的访问 token 似乎没有 Directory.AccessAsUser.All 权限。您可以使用 https://jwt.io/ 对其进行解码并检查'scp'中是否存在此权限。

enter image description here

我已经在我这边测试过它并且有效。这是我的主要步骤。

1.向您的应用添加 Directory.AccessAsUser.All 权限,然后单击授予管理员同意按钮

enter image description here

2.使用 auth code grant flow 获取访问 token 。您不能使用client credential grant flow此处,因为您必须使用用户登录。

关于azure - 尝试向用户添加架构扩展时权限不足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56527842/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com