Oops . . . did I delete that VM?
Accidents happen. Resource Locks help prevent them.
The Resource Lock level is applied at the resource group or resource scope. These can be set by the administrators can be set to CanNotDelete.
Using a modified version of the ARM Template from a post on creating a CentOS Virtual Machine, let’s provision a VM that is protected it from accidental deletion. The best thing about creating locks in ARM Templates, is that it centralizes the configuration. It makes it easier to maintain and simplifies our workflow.
As a best practice, we should consider creating Resource Locks for mission critical resources in our Azure Resource Manager (ARM) Templates.