rules/findings/Azure/Subscription/CIS3.0/azure-subscription-missing-resource-locks.json

{
  "args": [
     
  ],
  "provider": "Azure",
  "serviceType": "Subscription Security",
  "serviceName": "Subscription",
  "displayName": "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.",
  "rationale": "As an administrator, it may be necessary to lock a subscription, resource group, or resource to prevent other users in the organization from accidentally deleting or modifying critical resources. The lock level can be set to to CanNotDelete or ReadOnly to achieve this purpose.\r\n\t\t\t\t\t\r\n\t\t\t\t\t* `CanNotDelete` means authorized users can still read and modify a resource, but they can\u0027t delete the resource.\r\n\t\t\t\t\t* `ReadOnly` means authorized users can read a resource, but they can\u0027t delete or update the resource. Applying this lock is similar to restricting all authorized users to the permissions granted by the Reader role.",
  "impact": "There can be unintended outcomes of locking a resource. Applying a lock to a parent service will cause it to be inherited by all resources within. Conversely, applying a lock to a resource may not apply to connected storage, leaving it unlocked. Please see the documentation for further information.",
  "remediation": {
    "text": "###### From Azure Console\r\n\t\t\t\t\t1. Navigate to the specific Azure Resource or Resource Group\r\n\t\t\t\t\t2. For each of the mission critical resource, click on `Locks`\r\n\t\t\t\t\t3. Click `Add`\r\n\t\t\t\t\t4. Give the lock a name and a description, then select the type, `CanNotDelete` or `ReadOnly` as appropriate\t\t\t\t\t\r\n\t\t\t\t\tAssign the newly created role to the appropriate user.",
    "code": {
      "powerShell": null,
      "iac": null,
      "terraform": null,
      "other": null
    }
  },
  "recommendation": null,
  "references": [
    "https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/lock-resources?tabs=json"
  ],
  "compliance": [
    {
      "name": "CIS Microsoft Azure Foundations",
      "version": "3.0.0",
      "reference": "10.1",
      "profile": "Level 2"
    }
  ],
  "level": "medium",
  "tags": [
    "CIS Microsoft Azure Foundations"
  ],
  "rule": {
    "path": "az_locks",
    "subPath": null,
    "selectCondition": {
       
    },
    "query": [
      {
        "filter": [
          {
            "conditions": [
              [
                "locks.Count",
                "eq",
                "0"
              ]
            ]
          }
        ]
      }
    ],
    "shouldExist": null,
    "returnObject": null,
    "removeIfNotExists": null
  },
  "output": {
    "html": {
      "data": {
        "properties": {
           
        },
        "expandObject": null
      },
      "table": null,
      "decorate": [
         
      ],
      "emphasis": [
         
      ],
      "actions": {
        "objectData": {
          "properties": [
            "*"
          ],
          "expandObject": null,
          "limit": null
        },
        "showGoToButton": false,
        "showModalButton": false,
        "directLink": null
      }
    },
    "text": {
      "data": {
        "properties": {
           
        },
        "expandObject": null
      },
      "status": {
        "keyName": [
           
        ],
        "message": "",
        "defaultMessage": null
      },
      "properties": {
        "resourceName": null,
        "resourceId": null,
        "resourceType": null
      },
      "onlyStatus": false
    }
  },
  "idSuffix": "azure_subscription_missing_resource_locks",
  "notes": [
     
  ],
  "categories": [
     
  ]
}