Ensure no custom subscription administrator roles exist
Description
The principle of least privilege should be followed and only necessary privileges should be assigned instead of allowing full administrative access.
Rationale
Custom roles in Azure with administrative access can obfuscate the permissions granted and introduce complexity and blind spots to the management of privileged identities. For less mature security programs without regular identity audits, the creation of Custom roles should be avoided entirely. For more mature security programs with regular identity audits, Custom Roles should be audited for use and assignment, used minimally, and the principle of least privilege should be observed when granting permissions.
Impact
Subscriptions will need to be handled by Administrators with permissions.
Audit Procedure
Using Azure Portal
- From Azure Home select the Portal Menu.
- Select
Subscriptions. - Select a subscription.
- Select
Access control (IAM). - Select
Roles. - Click
Typeand selectCustom rolefrom the drop-down menu. - Select
Viewnext to a role. - Select
JSON. - Check for
assignableScopesset to the subscription, andactionsset to*. - Repeat steps 7-9 for each custom role.
Using Azure CLI
az role definition list --custom-role-only True
Check for entries with assignableScope of the subscription, and an action of *.
Using PowerShell
Connect-AzAccount
Get-AzRoleDefinition | Where-Object {($_.IsCustom -eq $true) -and ($_.Actions.contains('*'))}
Check the output for AssignableScopes value set to the subscription.
Using Azure Policy
- Policy ID: a451c1ef-c6ca-483d-87ed-f49761e3ffb5 - Name: 'Audit usage of custom RBAC roles'
Expected Result
No custom roles should exist with assignableScopes set to the subscription and actions set to *.
Remediation
Using Azure Portal
- From Azure Home select the Portal Menu.
- Select
Subscriptions. - Select a subscription.
- Select
Access control (IAM). - Select
Roles. - Click
Typeand selectCustom rolefrom the drop-down menu. - Check the box next to each role which grants subscription administrator privileges.
- Select
Delete. - Select
Yes.
Using Azure CLI
az role definition list --custom-role-only True
Check for entries with assignableScope of the subscription, and an action of *.
To remove a violating role:
az role definition delete --name <role name>
Note that any role assignments must be removed before a custom role can be deleted. Ensure impact is assessed before deleting a custom role granting subscription administrator privileges.
Default Value
By default, no custom owner roles are created.
References
- https://learn.microsoft.com/en-us/azure/cost-management-billing/manage/add-change-subscription-administrator
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-privileged-access#pa-1-separate-and-limit-highly-privilegedadministrative-users
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-privileged-access#pa-3-manage-lifecycle-of-identities-and-entitlements
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-governance-strategy#gs-2-define-and-implement-enterprise-segmentationseparation-of-duties-strategy
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-governance-strategy#gs-6-define-and-implement-identity-and-privileged-access-strategy
- https://learn.microsoft.com/en-us/security/benchmark/azure/mcsb-privileged-access#pa-7-follow-just-enough-administration-least-privilege-principle
CIS Controls
| Controls Version | Control | IG 1 | IG 2 | IG 3 |
|---|---|---|---|---|
| v8 | 5.4 Restrict Administrator Privileges to Dedicated Administrator Accounts | x | x | x |
| v8 | 6.8 Define and Maintain Role-Based Access Control | x | ||
| v7 | 4.1 Maintain Inventory of Administrative Accounts | x | x |
Profile
Level 1 | Automated