You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -42,6 +42,16 @@ When using Azure CLI to add or update conditions, you must use the following ver
42
42
43
43
-[Azure CLI 2.18 or later](/cli/azure/install-azure-cli)
44
44
45
+
## REST API
46
+
47
+
When using the REST API to add or update conditions, you must use the following versions:
48
+
49
+
-`2020-03-01-preview` or later
50
+
-`2020-04-01-preview` or later if you want to utilize the `description` property for role assignments
51
+
-`2022-04-01` is the first stable version
52
+
53
+
For more information, see [API versions of Azure RBAC REST APIs](/rest/api/authorization/versions).
54
+
45
55
## Permissions
46
56
47
57
Just like role assignments, to add or update conditions, you must be signed in to Azure with a user that has the `Microsoft.Authorization/roleAssignments/write` and `Microsoft.Authorization/roleAssignments/delete` permissions, such as [User Access Administrator](built-in-roles.md#user-access-administrator) or [Owner](built-in-roles.md#owner).
@@ -23,11 +23,17 @@ An [Azure role assignment condition](conditions-overview.md) is an additional ch
23
23
24
24
## Prerequisites
25
25
26
-
For information about the prerequisites to add or edit role assignment conditions, see [Conditions prerequisites](conditions-prerequisites.md).
26
+
You must use the following versions:
27
+
28
+
-`2020-03-01-preview` or later
29
+
-`2020-04-01-preview` or later if you want to utilize the `description` property for role assignments
30
+
-`2022-04-01` is the first stable version
31
+
32
+
For more information about the prerequisites to add or edit role assignment conditions, see [Conditions prerequisites](conditions-prerequisites.md).
27
33
28
34
## Add a condition
29
35
30
-
To add a role assignment condition, use the [Role Assignments - Create](/rest/api/authorization/roleassignments/create) REST API. Set the `api-version` to `2020-03-01-preview` or later. If you want to utilize the `description` property for role assignments, use `2020-04-01-preview` or later. [Role Assignments - Create](/rest/api/authorization/roleassignments/create) includes the following parameters related to conditions.
36
+
To add a role assignment condition, use the [Role Assignments - Create](/rest/api/authorization/role-assignments/create) REST API. [Role Assignments - Create](/rest/api/authorization/role-assignments/create) includes the following parameters related to conditions.
31
37
32
38
| Parameter | Type | Description |
33
39
| --- | --- | --- |
@@ -37,7 +43,7 @@ To add a role assignment condition, use the [Role Assignments - Create](/rest/ap
37
43
Use the following request and body:
38
44
39
45
```http
40
-
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2020-04-01-preview
46
+
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2022-04-01
41
47
```
42
48
43
49
```json
@@ -55,7 +61,7 @@ PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleA
55
61
The following example shows how to assign the [Storage Blob Data Reader](built-in-roles.md#storage-blob-data-reader) role with a condition. The condition checks whether container name equals 'blobs-example-container'.
56
62
57
63
```http
58
-
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2020-04-01-preview
64
+
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2022-04-01
59
65
```
60
66
61
67
```json
@@ -81,8 +87,8 @@ The following shows an example of the output:
"condition": "((!(ActionMatches{'Microsoft.Storage/storageAccounts/blobServices/containers/blobs/read'})) OR (@Resource[Microsoft.Storage/storageAccounts/blobServices/containers:name] StringEquals 'blobs-example-container'))",
83
89
"conditionVersion": "2.0",
84
-
"createdOn": "2021-04-20T06:20:44.0205560Z",
85
-
"updatedOn": "2021-04-20T06:20:44.2955371Z",
90
+
"createdOn": "2022-07-20T06:20:44.0205560Z",
91
+
"updatedOn": "2022-07-20T06:20:44.2955371Z",
86
92
"createdBy": null,
87
93
"updatedBy": "{updatedById}",
88
94
"delegatedManagedIdentityResourceId": null,
@@ -96,10 +102,10 @@ The following shows an example of the output:
96
102
97
103
## Edit a condition
98
104
99
-
To edit an existing role assignment condition, use the same [Role Assignments - Create](/rest/api/authorization/roleassignments/create) REST API as you used to add the role assignment condition. The following shows an example JSON where `condition` and `description` are updated. Only the `condition`, `conditionVersion`, and `description` properties can be edited. You must specify the other properties to match the existing role assignment.
105
+
To edit an existing role assignment condition, use the same [Role Assignments - Create](/rest/api/authorization/role-assignments/create) REST API as you used to add the role assignment condition. The following shows an example JSON where `condition` and `description` are updated. Only the `condition`, `conditionVersion`, and `description` properties can be edited. You must specify the other properties to match the existing role assignment.
100
106
101
107
```http
102
-
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2020-04-01-preview
108
+
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentId}?api-version=2022-04-01
103
109
```
104
110
105
111
```json
@@ -114,16 +120,15 @@ PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{
114
120
}
115
121
```
116
122
117
-
118
123
## List a condition
119
124
120
-
To list a role assignment condition, use the [Role Assignments - List](/rest/api/authorization/roleassignments/list) API. Set the `api-version` to `2020-03-01-preview`or later. If you want to utilize the `description` property for role assignments, use `2020-04-01-preview` or later. For more information, see [List Azure role assignments using the REST API](role-assignments-list-rest.md).
125
+
To list a role assignment condition, use the [Role Assignments](/rest/api/authorization/role-assignments) Get or List REST API. For more information, see [List Azure role assignments using the REST API](role-assignments-list-rest.md).
121
126
122
127
## Delete a condition
123
128
124
129
To delete a role assignment condition, edit the role assignment condition and set both the condition and condition version to either an empty string or null.
125
130
126
-
Alternatively, if you want to delete both the role assignment and the condition, you can use the [Role Assignments - Delete](/rest/api/authorization/roleassignments/delete) API. For more information, see [Remove Azure role assignments](role-assignments-remove.md).
131
+
Alternatively, if you want to delete both the role assignment and the condition, you can use the [Role Assignments - Delete](/rest/api/authorization/role-assignments/delete) API. For more information, see [Remove Azure role assignments](role-assignments-remove.md).
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. This article describes how to list, create, update, or delete custom roles using the REST API.
28
28
29
+
## Prerequisites
30
+
31
+
You must use the following version:
32
+
33
+
-`2015-07-01` or later
34
+
35
+
For more information, see [API versions of Azure RBAC REST APIs](/rest/api/authorization/versions).
36
+
29
37
## List custom roles
30
38
31
-
To list all custom roles in a directory, use the [Role Definitions - List](/rest/api/authorization/roledefinitions/list) REST API.
39
+
To list all custom roles in a directory, use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) REST API.
32
40
33
41
1. Start with the following request:
34
42
35
43
```http
36
-
GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?api-version=2015-07-01&$filter={filter}
44
+
GET https://management.azure.com/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter={filter}
37
45
```
38
46
39
47
1. Replace *{filter}* with the role type.
@@ -45,12 +53,12 @@ To list all custom roles in a directory, use the [Role Definitions - List](/rest
45
53
46
54
## List custom roles at a scope
47
55
48
-
To list custom roles at a scope, use the [Role Definitions - List](/rest/api/authorization/roledefinitions/list) REST API.
56
+
To list custom roles at a scope, use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) REST API.
49
57
50
58
1. Start with the following request:
51
59
52
60
```http
53
-
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2015-07-01&$filter={filter}
61
+
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter={filter}
54
62
```
55
63
56
64
1. Within the URI, replace *{scope}* with the scope for which you want to list the roles.
@@ -72,12 +80,12 @@ To list custom roles at a scope, use the [Role Definitions - List](/rest/api/aut
72
80
73
81
## List a custom role definition by name
74
82
75
-
To get information about a custom role by its display name, use the [Role Definitions - Get](/rest/api/authorization/roledefinitions/get) REST API.
83
+
To get information about a custom role by its display name, use the [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API.
76
84
77
85
1. Start with the following request:
78
86
79
87
```http
80
-
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2015-07-01&$filter={filter}
88
+
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter={filter}
81
89
```
82
90
83
91
1. Within the URI, replace *{scope}* with the scope for which you want to list the roles.
@@ -99,14 +107,14 @@ To get information about a custom role by its display name, use the [Role Defini
99
107
100
108
## List a custom role definition by ID
101
109
102
-
To get information about a custom role by its unique identifier, use the [Role Definitions - Get](/rest/api/authorization/roledefinitions/get) REST API.
110
+
To get information about a custom role by its unique identifier, use the [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API.
103
111
104
-
1. Use the [Role Definitions - List](/rest/api/authorization/roledefinitions/list) REST API to get the GUID identifier for the role.
112
+
1. Use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) REST API to get the GUID identifier for the role.
105
113
106
114
1. Start with the following request:
107
115
108
116
```http
109
-
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2015-07-01
117
+
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
110
118
```
111
119
112
120
1. Within the URI, replace *{scope}* with the scope for which you want to list the roles.
@@ -123,7 +131,7 @@ To get information about a custom role by its unique identifier, use the [Role D
123
131
124
132
## Create a custom role
125
133
126
-
To create a custom role, use the [Role Definitions - Create Or Update](/rest/api/authorization/roledefinitions/createorupdate) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/write` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
134
+
To create a custom role, use the [Role Definitions - Create Or Update](/rest/api/authorization/role-definitions/create-or-update) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/write` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
127
135
128
136
1. Review the list of [resource provider operations](resource-provider-operations.md) that are available to create the permissions for your custom role.
129
137
@@ -132,7 +140,7 @@ To create a custom role, use the [Role Definitions - Create Or Update](/rest/api
132
140
1. Start with the following request and body:
133
141
134
142
```http
135
-
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2015-07-01
143
+
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
136
144
```
137
145
138
146
```json
@@ -222,14 +230,14 @@ To create a custom role, use the [Role Definitions - Create Or Update](/rest/api
222
230
223
231
## Update a custom role
224
232
225
-
To update a custom role, use the [Role Definitions - Create Or Update](/rest/api/authorization/roledefinitions/createorupdate) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/write` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
233
+
To update a custom role, use the [Role Definitions - Create Or Update](/rest/api/authorization/role-definitions/create-or-update) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/write` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
226
234
227
-
1. Use the [Role Definitions - List](/rest/api/authorization/roledefinitions/list) or [Role Definitions - Get](/rest/api/authorization/roledefinitions/get) REST API to get information about the custom role. For more information, see the earlier [List custom roles](#list-custom-roles) section.
235
+
1. Use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) or [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API to get information about the custom role. For more information, see the earlier [List custom roles](#list-custom-roles) section.
228
236
229
237
1. Start with the following request:
230
238
231
239
```http
232
-
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2015-07-01
240
+
PUT https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}?api-version=2022-04-01
233
241
```
234
242
235
243
1. Within the URI, replace *{scope}* with the first `assignableScopes` of the custom role.
@@ -312,16 +320,16 @@ To update a custom role, use the [Role Definitions - Create Or Update](/rest/api
312
320
313
321
## Delete a custom role
314
322
315
-
To delete a custom role, use the [Role Definitions - Delete](/rest/api/authorization/roledefinitions/delete) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/delete` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
323
+
To delete a custom role, use the [Role Definitions - Delete](/rest/api/authorization/role-definitions/delete) REST API. To call this API, you must be signed in with a user that is assigned a role that has the `Microsoft.Authorization/roleDefinitions/delete` permission on all the `assignableScopes`. Of the built-in roles, only [Owner](built-in-roles.md#owner) and [User Access Administrator](built-in-roles.md#user-access-administrator) include this permission.
316
324
317
325
1. Remove any role assignments that use the custom role. For more information, see [Find role assignments to delete a custom role](custom-roles.md#find-role-assignments-to-delete-a-custom-role).
318
326
319
-
1. Use the [Role Definitions - List](/rest/api/authorization/roledefinitions/list) or [Role Definitions - Get](/rest/api/authorization/roledefinitions/get) REST API to get the GUID identifier of the custom role. For more information, see the earlier [List custom roles](#list-custom-roles) section.
327
+
1. Use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) or [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API to get the GUID identifier of the custom role. For more information, see the earlier [List custom roles](#list-custom-roles) section.
0 commit comments