Move Azure resources to another subscription or resource group

This article is about moving resources to another subscription or another resource group in the same subscription. This can be done using Azure portal, PowerShell, Azure CLI or the REST API.

To move resources, the source resource group and the target resource group both are locked during the operation and resources can’t be added, updated, or deleted in the resource groups but they are not frozen. For example, if a SQL Server is moved to a new resource group, the applications using the database will not experience any downtime. They would still be able to access the database(s). However, changing the location of the resource is not possible.

Below are the ways to move the resources:

Using Azure Portal

    1. Select the resource group containing the resources to be moved, and then click on Move.Move1.png
    2. Chose the option from moving the resources to another resource group or another subscription.Move2
    3. Select all those resources that are to be moved.
    4. Select the destination resource group. Acknowledge the message by clicking on checkbox before it and then click OK. You may even create an new resource group by clicking on “Create a new group”.
    5. The resources will start moving and notification is created on completion.Move3

Using PowerShell

In PowerShell, the Move-AzureRmResource command is used to move existing resources to another resource group or subscription.

Syntax:

Move-AzureRmResource -DestinationResourceGroupName NewRG -ResourceId

To move to a new subscription, include the DestinationSubscriptionId parameter in the above command.

 

Using Azure CLI

The az resource move command is used to move existing resources to another resource group or subscription, using Azure CLI. Provide the space-separated list of the resource IDs of the resources to move. The following example shows how to move multiple resources to a new resource group, in the –ids parameter.

Syntax:

az resource move –destination-group newgroup –ids $resource $plan

To move to a new subscription, provide the –destination-subscription-id parameter.

 

Using REST API

To move existing resources to another resource group or subscription, use the following post request

POST https://management.azure.com/subscriptions/{source-subscription-id}/resourcegroups/{source-resource-group-name}/moveResources?api-version={api-version}

Specify the target resource group and the resources to move in the request body.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: