blog.atwork.at

news and know-how about microsoft, technology, cloud and more.

Move resources in Microsoft Azure

It's a not so well known feature, that admins can transfer services in Microsoft Azure to reorganize their cloud services. This can be accomplished in the Azure Portal or programmatically. See here, how this works.

So, you can move services between resource groups and you can move services to another Azure subscription.This can be done in the (new) Azure Portal portal.azure.com.

When opening a resource, you see the "change" links to change the resource group and to change the subscription as in the screenshot here:

image

Be aware, that there might be dependent service and that you cannot move all services in Azure!

The article Move resources to new resource group or subscription informs about the details.

Most Azure services can be moved (see "Services that enable move") while others cannot be moved ("see "Services that do not enable move"), as for example. AAD, managed disks of VM's, availability sets, recovery services, virtual networks and more. Also, there are some limitations for App Service Plans (see "App Service limitations").

If services cannot be moved, you see a notification similar as here: In that case, the resources remain in the existing containers.

image

If the operation is working you see the progress in the notifications as here:

image

For using PowerShell, you can use the following cmdlets to move one resource to a new resource group:

$resource = Get-AzureRmResource -ResourceName ExampleApp -ResourceGroupName OldRG
Move-AzureRmResource -DestinationResourceGroupName NewRG -ResourceId $resource.ResourceId

..or move multiple resources to a new resource group:

$webapp = Get-AzureRmResource -ResourceGroupName OldRG -ResourceName ExampleSite
$plan = Get-AzureRmResource -ResourceGroupName OldRG -ResourceName ExamplePlan
Move-AzureRmResource -DestinationResourceGroupName NewRG -ResourceId $webapp.ResourceId, $plan.ResourceId

This can also be done with Azure CLI or the REST API.

Happy reorganizing!

Loading