Someone deleted a production resource group last night. How do you find out who, and prevent it?
IntermediateScenarioIdentity, Access and Governance
Answer
Situation read → Activity Log answers who; locks and RBAC prevent the repeat.
What I'd do →
- Query the Activity Log at subscription level (the RG is gone):
az monitor activity-log list --offset 2d \ --query "[?operationName.value=='Microsoft.Resources/subscriptions/resourceGroups/delete'].{who:caller, when:eventTimestamp, rg:resourceGroupName}" -o table - Restore from IaC plus data backups (Azure Backup, storage soft delete, SQL long-term retention)
- Add
CanNotDeletelocks on prod RGs holding state - Remove standing write access in prod; move humans to PIM
Why → Locks stop accidents by anyone, including Owners, without blocking normal updates.
Interview tip → Mention that you rebuilt from code; it proves IaC was real.
More on Identity, Access and Governance
A new developer joins and needs to deploy to the dev resource group only. How do you give access?BeginnerYour GitHub Actions workflow uses a client secret stored in a repo secret. Security wants it gone. What do you do?BeginnerAuditors ask "who has Owner on production, and why?" How do you answer and fix it?IntermediateA VM application needs to read blobs from one container. How do you set up access without keys?IntermediateTeams keep creating resources in random regions and without tags. How do you stop it?BeginnerA contractor needs temporary read access to logs for two weeks. How do you handle it?Beginner