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
#Customer intent: As an IT admin, I want to create custom and/or roles using Bicep so that I can start automating custom role processes.
@@ -37,6 +37,8 @@ The Bicep file used in this article is from [Azure Quickstart Templates](https:/
37
37
38
38
The scope where this custom role can be assigned is set to the current subscription.
39
39
40
+
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.
> Create a variable called **myActions** and then pass that variable. Replace the sample actions with the actions for the roleDefinition.
71
-
72
84
When the deployment finishes, you should see a message indicating the deployment succeeded.
73
85
74
86
## Review deployed resources
@@ -91,59 +103,42 @@ Get-AzRoleDefinition "Custom Role - RG Reader"
91
103
92
104
## Update a custom role
93
105
94
-
Similar to creating a custom role, you can update an existing custom role using Bicep. To update a custom role, you need to specify the role you want to update.
106
+
Similar to creating a custom role, you can update an existing custom role using Bicep. To update a custom role, you need to specify the role you want to update. If you previously created the custom role in Bicep with a unique role ID that is [deterministic](../azure-resource-manager/bicep/scenarios-rbac.md#name), you can use the same Bicep file and specify the custom role by just using the display name.
95
107
96
-
Here are the changes you would need to make to the previous Bicep file to update the custom role.
97
-
98
-
1. Include the role ID as a parameter.
99
-
100
-
```bicep
101
-
...
102
-
@description('ID of the role definition')
103
-
param roleDefName string
104
-
...
105
-
106
-
```
107
-
108
-
2. Remove the roleDefName variable. You'll get a warning if you have a parameter and variable with the same name.
109
-
3. Use Azure CLI or Azure PowerShell to get the roleDefName.
108
+
1. Specify the updated actions.
110
109
111
110
# [CLI](#tab/CLI)
112
111
113
112
```azurecli-interactive
114
-
az role definition list --name "Custom Role - RG Reader"
4. Use Azure CLI or Azure PowerShell to deploy the updated Bicep file, replacing **\<name-id\>** with the roleDefName, and replacing the sample actions with the updated actions for the roleDefinition.
124
+
1. Use Azure CLI or Azure PowerShell to update the custom role.
0 commit comments