Interview Prep/Azure/Quota, Deployment and IaC Errors

`ScopeLocked: The scope '/subscriptions/.../resourceGroups/rg-shop-prod' cannot perform delete operation because following scope(s) are locked: '/subscriptions/.../resourceGroups/rg-shop-prod'.`

BeginnerTroubleshootingQuota, Deployment and IaC Errors
Answer

Likely causes → A CanNotDelete or ReadOnly lock on the RG or a parent.

Diagnose → az lock list -g rg-shop-prod -o table and at subscription level.

Fix →

  1. If the delete is intended, remove the lock (needs Microsoft.Authorization/locks/delete, Owner or User Access Administrator): az lock delete -n no-delete -g rg-shop-prod
  2. Re-add after the change if appropriate

Prevent → Manage locks in IaC so their presence is intentional and visible.

Azure All Azure questions

More on Quota, Deployment and IaC Errors