是否可以为Azure AD中的用户或组分配多个角色?

时间:2015-10-20 17:08:24

标签: azure authorization roles azure-active-directory

当我向Azure AD中的应用程序清单添加appRoles部分时,我可以将用户和组分配给管理门户中的角色。

  "appRoles": [
    {
      "allowedMemberTypes": [
        "User"
      ],
      "description": "Can read data.",
      "displayName": "Data Reader",
      "id": "67fba7fa-e54e-4258-b95d-32b082eb771d",
      "isEnabled": true,
      "value": "reader"
    },
    {
      "allowedMemberTypes": [
        "User"
      ],
      "description": "Can create and edit data.",
      "displayName": "Data Writer",
      "id": "e36736c5-e923-435e-8e44-6cae90792931",
      "isEnabled": true,
      "value": "writer"
    }
  ],

但是,UI只允许我为用户或组分配一个角色。

我找不到如何为用户或组分配多个角色。我可以将用户添加到多个组并将角色分配给该组的成员,这将导致该用户的令牌中出现多个角色声明,但这看起来很尴尬。

我错过了什么吗?有没有办法为用户或组分配多个角色?

2 个答案:

答案 0 :(得分:5)

您可以在同一个应用中为同一个用户分配多个角色,但这个角色非常有限。基本上再次添加相同的用户并选择不同的角色:

enter image description here

该机制非常繁琐,无法扩展。如果您有AAD Premium Lvl 2,则可以将应用程序角色与组关联,当您将用户分配给该组时,它们将自动获得角色。自动分配仅适用于Premium Lvl 2。

答案 1 :(得分:3)

这证明是Azure management portal的限制。在此blog comment中,AAD PM解释了可以通过GraphAPI为用户或组分配多个角色。

有关详细信息,请参阅此MSDN blog article中的“分配应用程序角色”部分。