Microsoft Azure Administrator:Exam Guide AZ-103
上QQ阅读APP看书,第一时间看更新

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.

There are limitations for moving resources across different resource groups and subscriptions. For instance, a VM with managed disks that is deployed inside an availability zone cannot be moved. For more information about these limitations, you can refer to the following article:  https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-move-resources.

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:

  1. Navigate to the Azure portal by opening https://portal.azure.com.
  1. In the left-hand menu, select Resource groupsSelect the PacktResourceGroup that we created in the previous demonstration. Select all the VM resources from the list, and in the top menu, select Move:
Moving resources
  1. 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:
Moving resources
  1. 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.