Description:

Resource locking is a powerful protection mechanism that can prevent inadvertentmodification/deletion of resources within Azure subscriptions/Resource Groups and is arecommended NIST configuration.


Rationale:

Given the resource lock functionality is outside of standard Role Based AccessControl(RBAC), it would be prudent to create a resource lock administrator role to prevent inadvertent unlocking of resources.


Impact:

By adding this role, specific permissions may be granted for managing just resource locks rather than needing to provide the wide Owner or User Access Administrator role, reducing the risk of the user being able to do unintentional damage.


Audit:

From Azure Portal

1. In the Azure portal, open a subscription or resource group where you want toview assigned roles.

2. Select Access control (IAM)

3. Select Roles

4. Search for the custom role named <role_name> Ex. from remediation Resource Lock Administrator

5. Ensure that the role is assigned to the appropriate users.


Remediation:

From Azure Portal

1. In the Azure portal, open a subscription or resource group where you want thecustom role to be assigned.

2.Select Access control (IAM).

3. Click Add.

4. Select Add custom role.

5. In the Custom Role Name field enter Resource Lock Administrator.

6. In the Description field enter Can Administer Resource Locks.

7. For Baseline permissions select Start from scratch

8. Select next.

9. In the Permissions tab select Add permissions.

10.In the Search for a permission box, type in Microsoft.Authorization/locks tosearch for permissions.

11.Select the check box next to the permission Microsoft.Authorization/locks.

12.Select Add.

13.Select Review + create.

14.Select Create.

15.Assign the newly created role to the appropriate user.


From PowerShell:

Below is a power shell definition for a resource lock administrator role created at an

Azure Management group level

Import-Module Az.Accounts
Connect-AzAccount
$role = Get-AzRoleDefinition "User Access Administrator"
$role.Id = $null
$role.Name = "Resource Lock Administrator"
$role.Description = "Can Administer Resource Locks"
$role.Actions.Clear()
$role.Actions.Add("Microsoft.Authorization/locks/*")
$role.AssignableScopes.Clear()
* Scope at the Management group level Management group
$role.AssignableScopes.Add("/providers/Microsoft.Management/managementGroups/
MG-Name")
New-AzRoleDefinition -Role $role
Get-AzureRmRoleDefinition "Resource Lock Administrator"


References:

1. https://docs.microsoft.com/en-us/azure/role-based-access-control/custom-roles

2. https://docs.microsoft.com/en-us/azure/role-based-access-control/check-access

3.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-privileged-access#pa-1-protect-and-limit-highly-privileged-users

4.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3- privileged-access#pa-2-restrict-administrative-access-to-business-criticalsystems

5.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-privileged-access#pa-7-follow-just-enough-administration-least-privilege-principle

6.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-privileged-access#pa-5-automate-entitlement-management

7.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-governance-strategy#gs-2-define-enterprise-segmentation-strategy

8.https://docs.microsoft.com/en-us/security/benchmark/azure/security-controls-v3-governance-strategy#gs-6-define-identity-and-privileged-access-strategy