Skip to content

Commit 9fa9f07

Browse files
committed
Changes to Bicep quickstart
1 parent 0f632e0 commit 9fa9f07

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

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

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Get-AzRoleDefinition "Custom Role - RG Reader"
8888

8989
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.
9090

91-
Here are the changes you would need to make to the previous Bicep file to update the custom role:
91+
Here are the changes you would need to make to the previous Bicep file to update the name of the custom role:
9292

9393
- Include the role ID as a parameter.
9494

@@ -100,32 +100,43 @@ Here are the changes you would need to make to the previous Bicep file to update
100100
101101
```
102102
103-
- Add the role ID as a parameter. Remove the variable named roleDefName.
103+
- Remove the roleDefName variable. You'll get a warning if you have a parameter and variable with the same name.
104104
105-
```bicep
106-
...
107-
resource roleDef 'Microsoft.Authorization/roleDefinitions@2018-07-01' = {
108-
name: roleDefName
109-
properties : {
110-
...
111-
```
105+
To deploy the updated Bicep file, you need to specify the roleDefName. Use Azure CLI or Azure PowerShell to get the name.
106+
107+
# [CLI](#tab/CLI)
108+
109+
```azurecli-interactive
110+
az role definition list --name "Custom Role - RG Reader"
111+
```
112+
113+
# [PowerShell](#tab/PowerShell)
114+
115+
```azurepowershell-interactive
116+
Get-AzRoleDefinition -Name "Custom Role - RG Reader"
117+
```
118+
119+
---
112120

113-
Then, use Azure CLI or Azure PowerShell to deploy the updated Bicep file.
121+
Then, use Azure CLI or Azure PowerShell to deploy the updated Bicep file, replacing **<\name-id\>** with the roleDefName.
114122

115123
# [CLI](#tab/CLI)
116124

117125
```azurecli-interactive
118-
az deployment sub create --location eastus --name customrole --template-file main.bicep --parameters actions='("Microsoft.Resources/subscriptions/resourceGroups/read", "Microsoft.Resources/subscriptions/read")' roleDefName="name-id" roleName="Custom Role - RG Reader updated"
126+
az deployment sub create --location eastus --name customrole --template-file main.bicep --parameters actions='("Microsoft.Resources/subscriptions/resourceGroups/read", "Microsoft.Resources/subscriptions/read")' roleDefName="name-id" roleName="Custom Role - RG Reader"
119127
```
120128

121129
# [PowerShell](#tab/PowerShell)
122130

123131
```azurepowershell-interactive
124-
New-AzSubscriptionDeployment -Location eastus -Name customrole -TemplateFile ./main.bicep -actions $actions -roleDefName "name-id" -roleName "Custom Role - RG Reader updated"
132+
New-AzSubscriptionDeployment -Location eastus -Name customrole -TemplateFile ./main.bicep -actions $actions -roleDefName "name-id" -roleName "Custom Role - RG Reader"
125133
```
126134

127135
---
128136

137+
> [!NOTE]
138+
> It may take several minutes for the updated role definition to be propagated.
139+
129140
## Clean up resources
130141

131142
When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to remove the custom role.
@@ -142,9 +153,6 @@ az role definition delete --name "Custom Role - RG Reader"
142153
Remove-AzRoleDefinition -Name "Custom Role - RG Reader"
143154
```
144155

145-
> [!NOTE]
146-
> If you ran the update command, you need to instead pass "Custom Role - RG Reader updated".
147-
148156
---
149157

150158
## Next steps

0 commit comments

Comments
 (0)