【问题标题】:Why cant I add an element to the appRoles object within graph explorer?为什么我不能在图形资源管理器中向 appRoles 对象添加元素?
【发布时间】:2019-08-29 21:08:12
【问题描述】:

我在 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-directory saml


    【解决方案1】:

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

    此对象无效

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

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

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

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

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

    【讨论】:

    【解决方案2】:

    您只需要保留原来的两个 AppRole 并在请求正文中添加一个新的 AppRole 即可。

    {
        "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": {a meaningful value here}
        }]
    }
    

    请注意,为新 AppRole 的“值”设置一个有意义的值

    【讨论】:

      【解决方案3】:

      对我来说,问题是使用origin: "ServicePrincipal",然后我可以在“value”属性中设置任何内容(但不允许有空格)。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-10
        • 1970-01-01
        • 2010-12-18
        • 2016-12-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多