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
Copy file name to clipboardExpand all lines: articles/role-based-access-control/custom-roles.md
+189-8Lines changed: 189 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ ms.devlang: na
12
12
ms.topic: conceptual
13
13
ms.tgt_pltfrm: na
14
14
ms.workload: identity
15
-
ms.date: 04/30/2020
15
+
ms.date: 05/07/2020
16
16
ms.author: rolyon
17
17
ms.reviewer: bagovind
18
18
ms.custom: H1Hack27Feb2017
@@ -31,7 +31,11 @@ Custom roles can be shared between subscriptions that trust the same Azure AD di
31
31
32
32
## Custom role example
33
33
34
-
The following shows what a custom role looks like as displayed in JSON format. This custom role can be used for monitoring and restarting virtual machines.
34
+
When you create a custom role, it appears in the Azure portal with an orange resource icon.
35
+
36
+

37
+
38
+
The following shows what a custom role looks like as displayed using Azure PowerShell in JSON format. This custom role can be used for monitoring and restarting virtual machines.
35
39
36
40
```json
37
41
{
@@ -63,9 +67,45 @@ The following shows what a custom role looks like as displayed in JSON format. T
63
67
}
64
68
```
65
69
66
-
When you create a custom role, it appears in the Azure portal with an orange resource icon.
70
+
The following shows the same custom role as displayed using Azure CLI.
67
71
68
-

@@ -75,17 +115,17 @@ When you create a custom role, it appears in the Azure portal with an orange res
75
115
76
116
1. Determine the permissions you need
77
117
78
-
When you create a custom role, you need to know the resource provider operations that are available to define your permissions. To view the list of operations, see the [Azure Resource Manager resource provider operations](resource-provider-operations.md). You will add the operations to the `Actions` or `NotActions` properties of the [role definition](role-definitions.md). If you have data operations, you will add those to the `DataActions` or `NotDataActions` properties.
118
+
When you create a custom role, you need to know the operations that are available to define your permissions. To view the list of operations, see the [Azure Resource Manager resource provider operations](resource-provider-operations.md). You will add the operations to the `Actions` or `NotActions` properties of the [role definition](role-definitions.md). If you have data operations, you will add those to the `DataActions` or `NotDataActions` properties.
79
119
80
120
1. Create the custom role
81
121
82
-
Typically, you start with an existing built-in role and then modify it for your needs. Then you use the [New-AzRoleDefinition](/powershell/module/az.resources/new-azroledefinition) or [az role definition create](/cli/azure/role/definition#az-role-definition-create) commands to create the custom role. To create a custom role, you must have the `Microsoft.Authorization/roleDefinitions/write` permission on all `AssignableScopes`, such as [Owner](built-in-roles.md#owner) or [User Access Administrator](built-in-roles.md#user-access-administrator).
122
+
Typically, you start with an existing built-in role and then modify it for your needs. The easiest way to create a custom role is to use the Azure portal, but can you can also create custom roles using commands. To create a custom role, you must be signed in with a user that has the `Microsoft.Authorization/roleDefinitions/write` permission on all `AssignableScopes`, such as [Owner](built-in-roles.md#owner) or [User Access Administrator](built-in-roles.md#user-access-administrator).
83
123
84
124
1. Test the custom role
85
125
86
126
Once you have your custom role, you have to test it to verify that it works as you expect. If you need to make adjustments later, you can update the custom role.
87
127
88
-
For a step-by-step tutorial on how to create a custom role, see [Tutorial: Create an Azure custom role using Azure PowerShell](tutorial-custom-role-powershell.md) or [Tutorial: Create an Azure custom role using Azure CLI](tutorial-custom-role-cli.md).
128
+
For steps on how to create a custom role using the Azure portal, see [Create or update Azure custom roles using the Azure portal](custom-roles-portal.md).
89
129
90
130
## Custom role properties
91
131
@@ -126,7 +166,148 @@ The following list describes the limits for custom roles.
126
166
127
167
For more information about custom roles and management groups, see [Organize your resources with Azure management groups](../governance/management-groups/overview.md#custom-rbac-role-definition-and-assignment).
128
168
169
+
## Custom role formats
170
+
171
+
To create a custom role using the command line, you typically use JSON to specify the properties you want for the custom role. Depending on the tools you use, the JSON format will look slightly different. The following shows the JSON format depending on the tool.
172
+
173
+
### Azure PowerShell
174
+
175
+
To create a custom role using Azure PowerShell, you must provide following input.
176
+
177
+
```json
178
+
{
179
+
"Name": "",
180
+
"Description": "",
181
+
"Actions": [],
182
+
"NotActions": [],
183
+
"DataActions": [],
184
+
"NotDataActions": [],
185
+
"AssignableScopes": []
186
+
}
187
+
```
188
+
189
+
To update a custom role using Azure PowerShell, you must provide the following input. Note that the `Id` property has been added.
190
+
191
+
```json
192
+
{
193
+
"Name": "",
194
+
"Id": "",
195
+
"Description": "",
196
+
"Actions": [],
197
+
"NotActions": [],
198
+
"DataActions": [],
199
+
"NotDataActions": [],
200
+
"AssignableScopes": []
201
+
}
202
+
```
203
+
204
+
The following shows an example of the output when listing a custom role using Azure PowerShell and the [ConvertTo-Json](/powershell/module/microsoft.powershell.utility/convertto-json) command.
205
+
206
+
```json
207
+
{
208
+
"Name": "",
209
+
"Id": "",
210
+
"IsCustom": true,
211
+
"Description": "",
212
+
"Actions": [],
213
+
"NotActions": [],
214
+
"DataActions": [],
215
+
"NotDataActions": [],
216
+
"AssignableScopes": []
217
+
}
218
+
```
219
+
220
+
### Azure CLI
221
+
222
+
To create or update a custom role using Azure CLI, you must provide following input. This format is the same format when you create a custom role using Azure PowerShell.
223
+
224
+
```json
225
+
{
226
+
"Name": "",
227
+
"Description": "",
228
+
"Actions": [],
229
+
"NotActions": [],
230
+
"DataActions": [],
231
+
"NotDataActions": [],
232
+
"AssignableScopes": []
233
+
}
234
+
```
235
+
236
+
The following shows an example of the output when listing a custom role using Azure CLI.
237
+
238
+
```json
239
+
[
240
+
{
241
+
"assignableScopes": [],
242
+
"description": "",
243
+
"id": "",
244
+
"name": "",
245
+
"permissions": [
246
+
{
247
+
"actions": [],
248
+
"dataActions": [],
249
+
"notActions": [],
250
+
"notDataActions": []
251
+
}
252
+
],
253
+
"roleName": "",
254
+
"roleType": "CustomRole",
255
+
"type": "Microsoft.Authorization/roleDefinitions"
256
+
}
257
+
]
258
+
```
259
+
260
+
### REST API
261
+
262
+
To create or update a custom role using the REST API, you must provide following input. This format is the same format that gets generated when you create a custom role using the Azure portal.
263
+
264
+
```json
265
+
{
266
+
"properties": {
267
+
"roleName": "",
268
+
"description": "",
269
+
"assignableScopes": [],
270
+
"permissions": [
271
+
{
272
+
"actions": [],
273
+
"notActions": [],
274
+
"dataActions": [],
275
+
"notDataActions": []
276
+
}
277
+
]
278
+
}
279
+
}
280
+
```
281
+
282
+
The following shows an example of the output when listing a custom role using the REST API.
0 commit comments