首页 > 解决方案 > 为什么我不能在图形资源管理器中向 appRoles 对象添加元素?

问题描述

我在 azure 中创建了一个应用程序,我现在有兴趣向应用程序用户添加特定角色,以便允许将角色数据作为 SAML 集成的一部分放入令牌中。

问题是我无法运行 PATCH 并将第三个元素添加到 appRoles 对象。这是我在此处运行 GET 后的对象 https://graph.microsoft.com/beta/servicePrincipals/ {ID}

{
"appRoles": [{
        "allowedMemberTypes": ["User"],
        "description": "msiam_access",
        "displayName": "msiam_access",
        "id": "b9632174-c057-4f7e-951b-be3adc52bfe6",
        "isEnabled": true,
        "origin": "Application",
        "value": null
    }, {
        "allowedMemberTypes": ["User"],
        "description": "User",
        "displayName": "User",
        "id": "18d14569-c3bd-439b-9a66-3a2aee01d14f",
        "isEnabled": true,
        "origin": "Application",
        "value": null
    }
]

}

我只是在该集合中添加第三个元素,如

, {
        "allowedMemberTypes": ["User"],
        "description": "groupdescription1",
        "displayName": "groupdisplayName1",
        "id": "9ef0f137-69c7-4ae1-ad90-28363c1f58ba",
        "isEnabled": true,
        "origin": "Application",
        "value": null
    }

但是,在使用第三个元素运行 PATCH 更新后,我收到

{
"error": {
    "code": "Request_BadRequest",
    "message": "One or more properties on the service principal does not match the application object.",
    "innerError": {
        "request-id": "819a5e01-3005-413a-9c36-a698dd90b88d",
        "date": "2019-08-29T21:03:23"
    }
}

}

在此处输入图像描述

我可以只用 2 个元素运行 PATCH 更新。还行吧。但为什么它不允许第三个元素?

我在这里阅读https://docs.microsoft.com/en-us/graph/api/resources/approle?view=graph-rest-beta

此功能在当前版本中被禁用。

这是否意味着我无法实现添加第三个角色的目标?我在这里想念什么?任何帮助表示赞赏。

我在这里看到 https://dailysysadmin.com/KB/Article/2970/configuring-azure-active-directory-as-an-identity-source-for-multiple-applications-sso-single-sign-on/ 这是可能的 1 点。

标签: azure-active-directorysaml

解决方案


解决方案:从新对象中删除属性“原点”。

此对象无效

{
    "allowedMemberTypes": ["User"],
    "description": "groupdescription1",
    "displayName": "groupdisplayName1",
    "id": "9ef0f137-69c7-4ae1-ad90-28363c1f58ba",
    "isEnabled": true,
    "ORIGIN": "Application",
    "value": null
}

一旦我删除origin属性,并重试了 PATCH,它就像一个魅力。

我想这个错误很有指示性,

服务主体上的一个或多个属性与应用程序对象不匹配

只是没有无效的字段名称。我错误地认为我可以从 GET 复制对象,然后粘贴到 PATCH 正文中。


推荐阅读