Skip to content

Commit dc52b1b

Browse files
committed
Restore code template reference
1 parent 42a9f52 commit dc52b1b

File tree

1 file changed

+3
-39
lines changed

1 file changed

+3
-39
lines changed

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

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -39,43 +39,7 @@ The scope where this custom role can be assigned is set to the current subscript
3939

4040
A custom role requires a unique ID. The ID can be generated with the [guid()](../azure-resource-manager/bicep/bicep-functions-string.md#guid) function. Since a custom role also requires a [unique display name](custom-roles.md#custom-role-properties) for the tenant, you can use the role name as a parameter for the `guid()` function to create a [deterministic GUID](../azure-resource-manager/bicep/scenarios-rbac.md#name). A deterministic GUID is useful if you later need to update the custom role using the same Bicep file.
4141

42-
```bicep
43-
targetScope = 'subscription'
44-
45-
@description('Array of actions for the roleDefinition')
46-
param actions array = [
47-
'Microsoft.Resources/subscriptions/resourceGroups/read'
48-
]
49-
50-
@description('Array of notActions for the roleDefinition')
51-
param notActions array = []
52-
53-
@description('Friendly name of the role definition')
54-
param roleName string = 'Custom Role - RG Reader'
55-
56-
@description('Detailed description of the role definition')
57-
param roleDescription string = 'Subscription Level Deployment of a Role Definition'
58-
59-
var roleDefId = guid(roleName)
60-
61-
resource roleDef 'Microsoft.Authorization/roleDefinitions@2022-04-01' = {
62-
name: roleDefId
63-
properties: {
64-
roleName: roleName
65-
description: roleDescription
66-
type: 'customRole'
67-
permissions: [
68-
{
69-
actions: actions
70-
notActions: notActions
71-
}
72-
]
73-
assignableScopes: [
74-
subscription().id
75-
]
76-
}
77-
}
78-
```
42+
:::code language="bicep" source="~/quickstart-templates/subscription-deployments/create-role-def/main.bicep":::
7943

8044
The resource defined in the Bicep file is:
8145

@@ -157,7 +121,7 @@ Similar to creating a custom role, you can update an existing custom role using
157121
158122
---
159123
160-
1. Use Azure CLI or Azure PowerShell to update roleDefinition.
124+
1. Use Azure CLI or Azure PowerShell to update the custom role.
161125
162126
# [CLI](#tab/CLI)
163127
@@ -174,7 +138,7 @@ Similar to creating a custom role, you can update an existing custom role using
174138
---
175139
176140
> [!NOTE]
177-
> It may take several minutes for the updated role definition to be propagated.
141+
> It may take several minutes for the updated custom role to be propagated.
178142
179143
## Clean up resources
180144

0 commit comments

Comments
 (0)