Control: 6.2 Ensure that Resource Locks are set for Mission-Critical Azure Resources
Description
Resource Manager Locks provide a way for administrators to lock down Azure resources to prevent deletion of, or modifications to, a resource. These locks sit outside of the Role Based Access Controls (RBAC) hierarchy and, when applied, will place restrictions on the resource for all users. These locks are very useful when there is an important resource in a subscription that users should not be able to delete or change. Locks can help prevent accidental and malicious changes or deletion.
While an automated assessment procedure exists for this recommendation, the assessment status remains manual. Determining resources that require resource locks depends on the context and requirements of each organization and environment.
Remediation
Remediate from Azure Portal
- Navigate to the specific Azure Resource or Resource Group.
- For each mission critical resource, click on
Locks. - Click
Add. - Give the lock a name and a description, then select the type,
Read-onlyorDeleteas appropriate. - Click
OK.
Remediate from Azure CLI
To lock a resource, provide the name of the resource, its resource type, and its resource group name.
az lock create --name <LockName> --lock-type <CanNotDelete/Read-only> --resource-group <resourceGroupName> --resource-name <resourceName> --resourcetype <resourceType>
Remediate from PowerShell
Get-AzResourceLock -ResourceName <Resource Name> -ResourceType <ResourceType> -ResourceGroupName <Resource Group Name> -Locktype <CanNotDelete/Readonly>
Default Value
By default, no locks are set.
Usage
Run the control in your terminal:
powerpipe control run azure_compliance.control.cis_v500_6_2Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run azure_compliance.control.cis_v500_6_2 --shareSQL
This control uses a named query:
select id as resource, 'info' as status, 'Manual verification required.' as reason, display_name as subscriptionfrom azure_subscription;