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
To list custom roles at a scope, use the [Role Definitions - List](/rest/api/authorization/role-definitions/list) REST API.
57
110
58
111
1. Start with the following request:
59
112
60
113
```http
61
-
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter={filter}
114
+
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?$filter={filter}&api-version=2022-04-01
62
115
```
63
116
64
117
1. Within the URI, replace *{scope}* with the scope for which you want to list the roles.
@@ -78,14 +131,67 @@ To list custom roles at a scope, use the [Role Definitions - List](/rest/api/aut
78
131
> | --- | --- |
79
132
> | `$filter=type+eq+'CustomRole'` | Filter based on the CustomRole type |
80
133
134
+
The following example lists all custom roles in a subscription:
135
+
136
+
**Request**
137
+
138
+
```http
139
+
GET https://management.azure.com/subscriptions/473a4f86-11e3-48cb-9358-e13c220a2f15/providers/Microsoft.Authorization/roleDefinitions?$filter=type+eq+'CustomRole'&api-version=2022-04-01
140
+
```
141
+
142
+
**Response**
143
+
144
+
```json
145
+
{
146
+
"value": [
147
+
{
148
+
"properties": {
149
+
"roleName": "Billing Reader Plus",
150
+
"type": "CustomRole",
151
+
"description": "Read billing data and download invoices",
To get information about a custom role by its display name, use the [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API.
84
190
85
191
1. Start with the following request:
86
192
87
193
```http
88
-
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?api-version=2022-04-01&$filter={filter}
194
+
GET https://management.azure.com/{scope}/providers/Microsoft.Authorization/roleDefinitions?$filter={filter}&api-version=2022-04-01
89
195
```
90
196
91
197
1. Within the URI, replace *{scope}* with the scope for which you want to list the roles.
@@ -105,6 +211,59 @@ To get information about a custom role by its display name, use the [Role Defini
105
211
> | --- | --- |
106
212
> | `$filter=roleName+eq+'{roleDisplayName}'` | Use the URL encoded form of the exact display name of the role. For instance, `$filter=roleName+eq+'Virtual%20Machine%20Contributor'` |
107
213
214
+
The following example lists a custom role named Billing Reader Plus in a subscription:
215
+
216
+
**Request**
217
+
218
+
```http
219
+
GET https://management.azure.com/subscriptions/473a4f86-11e3-48cb-9358-e13c220a2f15/providers/Microsoft.Authorization/roleDefinitions?$filter=roleName+eq+'Billing Reader Plus'&api-version=2022-04-01
220
+
```
221
+
222
+
**Response**
223
+
224
+
```json
225
+
{
226
+
"value": [
227
+
{
228
+
"properties": {
229
+
"roleName": "Billing Reader Plus",
230
+
"type": "CustomRole",
231
+
"description": "Read billing data and download invoices",
To get information about a custom role by its unique identifier, use the [Role Definitions - Get](/rest/api/authorization/role-definitions/get) REST API.
@@ -129,6 +288,55 @@ To get information about a custom role by its unique identifier, use the [Role D
129
288
130
289
1. Replace *{roleDefinitionId}* with the GUID identifier of the role definition.
131
290
291
+
The following example lists a custom role with the identifier 17adabda-4bf1-4f4e-8c97-1f0cab6dea1c in a subscription:
292
+
293
+
**Request**
294
+
295
+
```http
296
+
GET https://management.azure.com/subscriptions/473a4f86-11e3-48cb-9358-e13c220a2f15/providers/Microsoft.Authorization/roleDefinitions/17adabda-4bf1-4f4e-8c97-1f0cab6dea1c?api-version=2022-04-01
297
+
```
298
+
299
+
**Response**
300
+
301
+
```json
302
+
{
303
+
"properties": {
304
+
"roleName": "Billing Reader Plus",
305
+
"type": "CustomRole",
306
+
"description": "Read billing data and download invoices",
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.
0 commit comments