Your company has an Azure subscription containing multiple development environments. You need to delegate the management of virtual machines to a development operations team. The team must be able to perform all virtual machine operations except deleting virtual machines. The delegation must follow the principle of least privilege, apply only to the development subscription, and be assigned to a Microsoft Entra ID security group. You decide to create a custom RBAC role to meet these requirements.
In which order should you perform the steps to configure and apply the custom role?
- 1Run `Get-AzRoleDefinition` to export an existing built-in role to a JSON template.
- 2Modify the JSON file to include the required permissions in the `Actions` array, exclude delete permissions using the `NotActions` array, and specify the subscription ID in the `AssignableScopes` array.
- 3Run `New-AzRoleDefinition` to register the custom role in the Azure tenant using the modified JSON file.
- 4Assign the registered custom role to the designated Microsoft Entra security group at the subscription scope.
Answer
Export the template, modify the JSON file to set actions and assignable scopes, register the custom role in the tenant, and then assign the role to the Entra ID security group at the subscription scope.
To create and apply a custom Azure RBAC role, you must follow a structured lifecycle. First, retrieve a JSON template using an existing role. Second, customize the `Actions`, `NotActions`, and `AssignableScopes` fields inside the JSON to align with least privilege and target scope. Third, register the custom role within the Microsoft Entra tenant using the command `New-AzRoleDefinition`. Finally, assign the registered role to the Microsoft Entra ID security group at the desired subscription scope.
Step-by-Step Solution
Key Concept
Azure Custom Role Lifecycle and Assignment