# AZ-104 - Governance and Compliance - Locking and Moving Resources

[Control and organize Azure resources with Azure Resource Manager](https://learn.microsoft.com/en-us/training/modules/control-and-organize-with-azure-resource-manager/)

[Move Azure resources to another resource group](https://learn.microsoft.com/en-us/training/modules/move-azure-resources-another-resource-group/ "Move Azure resources to another resource group")

#####  

#####  

##### **What are Locks**

- Locks allow you to override permissions to resources.
- You can lock subscriptions, resources groups or resources.
- Lock Restrictions apply to all users and roles.

##### Lock types 

- Read-only allows authorized users to read a resource, but they cannot delete or update the resource.
- Cannot-delete allows authorized users to read and modify a resource, but they cannot delete the resource.
- Locks are inherited from the parent scope.

Moving resources is the process of actually moving resources that are contained in a specific place in Azure

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/oMBim7RaoSKWM0Wt-image.png)

Navigate in azure portal to your resource group and add a lock

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/mOz2VLJEbBwjgDdt-image.png)

Add Lock to DontDelete or whatever random name, assign to Delete, from this page you can edit or delete the lock.

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/vAwzf3qfiUcrtR77-image.png)

Now with a lock let's select all resources and ht delete

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/xzEjjtyaIk5mguTF-image.png)

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/OsJxieIm8fO8UQ1o-image.png)

We are unable to delete because of the lock delete rule

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/uEJjyj9SRy1rBS2I-image.png)

Now lets go to a specific resource inside our resource group, let's go to our VM

first we need to stop the resource then hit refresh, wait for the status to stopped.

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/r5HexEZmy7DgEjyu-image.png)

Let's go back to modify our resource group lock from Delete to Read Only

we go to our resource group, select lock (hit refresh if not shown) then edit, we will modify lock type from Delete to Read-only and hit ok

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/g1DMIfySz56BnxSO-image.png)

We will refresh and make sure its now read-only

[![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/1CLsz6K5Jj6gHma4-image.png)](https://wiki.tinod.net/uploads/images/gallery/2024-02/1CLsz6K5Jj6gHma4-image.png)

let's go back to our resources overview, open the VM again and let's Start our VM, we get a warning message, cannot perform write operation, please remove read-only lock

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/sbwKQhZSHrmthKGh-image.png)

Now if we go back to our resources group we can select all our resources, from here we can click on Move, here you can move resources too another resource group, to another subscription or to another region.

![image.png](https://wiki.tinod.net/uploads/images/gallery/2024-02/scaled-1680-/OPwAgPWBDPttoIV2-image.png)