Moving resources across resource groups
You can easily move your resources across different resource groups and subscriptions by using the Azure portal, PowerShell, the CLI, and the REST API. During the move operation, both the source group and the target group are locked. This blocks all write and delete operations on the resource group until the movement is complete. This means that you cannot update, add, or delete resources in the resource group, but the resources aren't frozen. There will be no downtime for these resources. However, the location of the resources will remain the same, even when the new resource group is created in a different location.
In the following demonstration, we are going to move resources from a resource group to another resource group using the Azure portal. For this demonstration, I've added a VM to this resource group and created a new resource group called PacktResourceGroup1. To move this VM, perform the following steps:
- Navigate to the Azure portal by opening https://portal.azure.com.
- In the left-hand menu, select Resource groups. Select the PacktResourceGroup that we created in the previous demonstration. Select all the VM resources from the list, and in the top menu, select Move:
- You have two possibilities: Move to another resource group and Move to another subscription. Click on Move to another resource group, and in the next screen, select PacktResourceGroup1 as the resource group, and check the checkbox underneath:
- Click on OK to move the resources to the other resource group.
After moving the resources, you can open the overview blade of PacktResourceGroup1. You will see that all the resources have been moved.
In the next (and final) section of this chapter, we are going to remove the resource group.