Skip to content

Commit df1f655

Browse files
Merge pull request #208551 from rolyon/rolyon-rbac-custom-roles-assignable-scopes
[Azure RBAC] Custom roles and assignable scopes
2 parents aa89514 + b6a2eef commit df1f655

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

articles/role-based-access-control/custom-roles.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: karenhoran
77
ms.service: role-based-access-control
88
ms.topic: conceptual
99
ms.workload: identity
10-
ms.date: 07/28/2022
10+
ms.date: 08/19/2022
1111
ms.author: rolyon
1212
---
1313

@@ -20,7 +20,7 @@ ms.author: rolyon
2020
2121
If the [Azure built-in roles](built-in-roles.md) don't meet the specific needs of your organization, you can create your own custom roles. Just like built-in roles, you can assign custom roles to users, groups, and service principals at management group (in preview only), subscription, and resource group scopes.
2222

23-
Custom roles can be shared between subscriptions that trust the same Azure AD directory. There is a limit of **5,000** custom roles per directory. (For Azure Germany and Azure China 21Vianet, the limit is 2,000 custom roles.) Custom roles can be created using the Azure portal, Azure PowerShell, Azure CLI, or the REST API.
23+
Custom roles can be shared between subscriptions that trust the same Azure AD tenant. There is a limit of **5,000** custom roles per tenant. (For Azure Germany and Azure China 21Vianet, the limit is 2,000 custom roles.) Custom roles can be created using the Azure portal, Azure PowerShell, Azure CLI, or the REST API.
2424

2525
## Steps to create a custom role
2626

@@ -148,15 +148,15 @@ The following table describes what the custom role properties mean.
148148

149149
| Property | Required | Type | Description |
150150
| --- | --- | --- | --- |
151-
| `Name`</br>`roleName` | Yes | String | The display name of the custom role. While a role definition is a management group or subscription-level resource, a role definition can be used in multiple subscriptions that share the same Azure AD directory. This display name must be unique at the scope of the Azure AD directory. Can include letters, numbers, spaces, and special characters. Maximum number of characters is 512. |
151+
| `Name`</br>`roleName` | Yes | String | The display name of the custom role. While a role definition is a management group or subscription-level resource, a role definition can be used in multiple subscriptions that share the same Azure AD tenant. This display name must be unique at the scope of the Azure AD tenant. Can include letters, numbers, spaces, and special characters. Maximum number of characters is 512. |
152152
| `Id`</br>`name` | Yes | String | The unique ID of the custom role. For Azure PowerShell and Azure CLI, this ID is automatically generated when you create a new role. |
153153
| `IsCustom`</br>`roleType` | Yes | String | Indicates whether this is a custom role. Set to `true` or `CustomRole` for custom roles. Set to `false` or `BuiltInRole` for built-in roles. |
154154
| `Description`</br>`description` | Yes | String | The description of the custom role. Can include letters, numbers, spaces, and special characters. Maximum number of characters is 2048. |
155155
| `Actions`</br>`actions` | Yes | String[] | An array of strings that specifies the control plane actions that the role allows to be performed. For more information, see [Actions](role-definitions.md#actions). |
156156
| `NotActions`</br>`notActions` | No | String[] | An array of strings that specifies the control plane actions that are excluded from the allowed `Actions`. For more information, see [NotActions](role-definitions.md#notactions). |
157157
| `DataActions`</br>`dataActions` | No | String[] | An array of strings that specifies the data plane actions that the role allows to be performed to your data within that object. If you create a custom role with `DataActions`, that role cannot be assigned at the management group scope. For more information, see [DataActions](role-definitions.md#dataactions). |
158158
| `NotDataActions`</br>`notDataActions` | No | String[] | An array of strings that specifies the data plane actions that are excluded from the allowed `DataActions`. For more information, see [NotDataActions](role-definitions.md#notdataactions). |
159-
| `AssignableScopes`</br>`assignableScopes` | Yes | String[] | An array of strings that specifies the scopes that the custom role is available for assignment. Maximum number of `AssignableScopes` is 2,000. You can define only one management group in `AssignableScopes` of a custom role. Adding a management group to `AssignableScopes` is currently in preview. For more information, see [AssignableScopes](role-definitions.md#assignablescopes). |
159+
| `AssignableScopes`</br>`assignableScopes` | Yes | String[] | An array of strings that specifies the scopes that the custom role is available for assignment. Maximum number of `AssignableScopes` is 2,000. For more information, see [AssignableScopes](role-definitions.md#assignablescopes). |
160160

161161
Permission strings are case-insensitive. When you create your custom roles, the convention is to match the case that you see for permissions in [Azure resource provider operations](resource-provider-operations.md).
162162

@@ -197,23 +197,23 @@ Before you can delete a custom role, you must remove any role assignments that u
197197
Here are steps to help find the role assignments before deleting a custom role:
198198

199199
- List the [custom role definition](role-definitions-list.md).
200-
- In the [assignable scopes](role-definitions.md#assignablescopes) section, get the management groups, subscriptions, and resource groups.
201-
- Iterate over the assignable scopes and [list the role assignments](role-assignments-list-portal.md).
200+
- In the [AssignableScopes](role-definitions.md#assignablescopes) section, get the management groups, subscriptions, and resource groups.
201+
- Iterate over the `AssignableScopes` and [list the role assignments](role-assignments-list-portal.md).
202202
- [Remove the role assignments](role-assignments-remove.md) that use the custom role.
203203
- [Delete the custom role](custom-roles-portal.md#delete-a-custom-role).
204204

205205
## Custom role limits
206206

207207
The following list describes the limits for custom roles.
208208

209-
- Each directory can have up to **5000** custom roles.
210-
- Azure Germany and Azure China 21Vianet can have up to 2000 custom roles for each directory.
209+
- Each tenant can have up to **5000** custom roles.
210+
- Azure Germany and Azure China 21Vianet can have up to 2000 custom roles for each tenant.
211211
- You cannot set `AssignableScopes` to the root scope (`"/"`).
212212
- You cannot use wildcards (`*`) in `AssignableScopes`. This wildcard restriction helps ensure a user can't potentially obtain access to a scope by updating the role definition.
213213
- You can only define one management group in `AssignableScopes` of a custom role. Adding a management group to `AssignableScopes` is currently in preview.
214214
- You can have only one wildcard in an action string.
215215
- Custom roles with `DataActions` cannot be assigned at the management group scope.
216-
- Azure Resource Manager doesn't validate the management group's existence in the role definition's assignable scope.
216+
- Azure Resource Manager doesn't validate the management group's existence in the role definition's `AssignableScopes`.
217217

218218
For more information about custom roles and management groups, see [What are Azure management groups?](../governance/management-groups/overview.md#azure-custom-role-definition-and-assignment).
219219

articles/role-based-access-control/role-definitions.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ manager: karenhoran
88
ms.service: role-based-access-control
99
ms.topic: conceptual
1010
ms.workload: identity
11-
ms.date: 01/06/2022
11+
ms.date: 08/19/2022
1212
ms.author: rolyon
1313
ms.custom:
1414
---
@@ -335,9 +335,13 @@ The following table shows two examples of the effective date plane permissions f
335335
336336
## AssignableScopes
337337

338-
The `AssignableScopes` property specifies the scopes (management groups, subscriptions, or resource groups) where this role definition can be assigned. You can make the role available for assignment in only the management groups, subscriptions, or resource groups that require it. You must use at least one management group, subscription, or resource group.
338+
The `AssignableScopes` property specifies the scopes (root, management group, subscriptions, or resource groups) where a role definition can be assigned. You can make a custom role available for assignment in only the management group, subscriptions, or resource groups that require it. You must use at least one management group, subscription, or resource group.
339339

340-
Built-in roles have `AssignableScopes` set to the root scope (`"/"`). The root scope indicates that the role is available for assignment in all scopes. Examples of valid assignable scopes include:
340+
For example, if `AssignableScopes` is set to a subscription, that means that the custom role is available for assignment at subscription scope for the specified subscription, resource group scope for any resource group in the subscription, or resource scope for any resource in the subscription.
341+
342+
Built-in roles have `AssignableScopes` set to the root scope (`"/"`). The root scope indicates that the role is available for assignment in all scopes.
343+
344+
Examples of valid assignable scopes include:
341345

342346
> [!div class="mx-tableFixed"]
343347
> | Role is available for assignment | Example |
@@ -349,7 +353,11 @@ Built-in roles have `AssignableScopes` set to the root scope (`"/"`). The root s
349353
> | Management group and a subscription | `"/providers/Microsoft.Management/managementGroups/{groupId1}", "/subscriptions/{subscriptionId1}",` |
350354
> | All scopes (applies only to built-in roles) | `"/"` |
351355
352-
For information about `AssignableScopes` for custom roles, see [Azure custom roles](custom-roles.md).
356+
You can define only one management group in `AssignableScopes` of a custom role. Adding a management group to `AssignableScopes` is currently in preview.
357+
358+
Although it's possible to create a custom role with a resource instance in `AssignableScopes` using the command line, it's not recommended. Each tenant supports a maximum of 5000 custom roles. Using this strategy could potentially exhaust your available custom roles. Ultimately, the level of access is determined by the custom role assignment (scope + role permissions + security principal) and not the `AssignableScopes` listed in the custom role. So, create your custom roles with `AssignableScopes` of management group, subscription, or resource group, but assign the custom roles with narrow scope, such as resource or resource group.
359+
360+
For more information about `AssignableScopes` for custom roles, see [Azure custom roles](custom-roles.md).
353361

354362
## Next steps
355363

0 commit comments

Comments
 (0)