Manage move collections and resource groups
This article describes how to remove resources from a move collection, or remove a move collection/resource group, in Azure Resource Mover. Move collections are used when moving Azure resources between Azure regions.
Remove a resource on portal
You can remove resources in a move collection, in the Resource Mover portal as follows:
On the Azure Resource Mover > Across regions pane, select all the resources you want to remove from the collection, and select Remove.
In Remove resources, select Remove.
Remove a move collection or a resource group on portal
You can remove a move collection/resource group in the portal. Removing a move collection/resource group deletes all the resources in the collection.
To remove a move collection/resource group, follow these steps:
- Follow these instructions to remove resources from the collection. If you're removing a resource group, make sure it doesn't contain any resources.
- Delete the move collection or resource group.
Remove a resource using PowerShell
Using PowerShell cmdlets you can remove a single resource from a MoveCollection, or remove multiple resources.
Remove a single resource
Remove a resource (in our example the virtual network psdemorm-vnet) as follows:
# Remove a resource using the resource ID
Remove-AzResourceMoverMoveResource -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-chinaeast-chinanorth-demoRMS" -Name "psdemorm-vnet"
Output after running cmdlet
Remove multiple resources
Remove multiple resources as follows:
Validate dependencies:
$resp = Invoke-AzResourceMoverBulkRemove -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-chinaeast-chinanorth-demoRMS" -MoveResource $('psdemorm-vnet') -ValidateOnly
Output after running cmdlet
Retrieve the dependent resources that need to be removed (along with our example virtual network psdemorm-vnet):
$resp.AdditionalInfo[0].InfoMoveResource
Output after running cmdlet
Remove all resources, along with the virtual network:
Invoke-AzResourceMoverBulkRemove -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-chinaeast-chinanorth-demoRMS" -MoveResource $('PSDemoVM','psdemovm111', 'PSDemoRM-vnet','PSDemoVM-nsg')
Output after running cmdlet
Remove a collection using PowerShell
Remove an entire move collection from the subscription, as follows:
Follow these instructions to remove resources in the collection using PowerShell.
Then remove a collection as follows:
Remove-AzResourceMoverMoveCollection -ResourceGroupName "RG-MoveCollection-demoRMS" -MoveCollectionName "PS-chinaeast-chinanorth-demoRMS"
Output after running cmdlet
Note
For removing resources in bulk where the dependency tree is not identified, use Invoke-AzResourceMoverBulkRemove (Az.ResourceMover).
VM resource state after removing
What happens when you remove a VM resource from a move collection depends on the resource state, as summarized in the table.
Remove VM state
Resource state | VM | Networking |
---|---|---|
Added to move collection | Delete from move collection. | Delete from move collection. |
Dependencies resolved/prepare pending | Delete from move collection | Delete from move collection. |
Prepare in progress (or any other state in progress) |
Delete operation fails with error. | Delete operation fails with error. |
Prepare failed | Delete from the move collection. Delete anything created in the target region, including replica disks. Infrastructure resources created during the move need to be deleted manually. |
Delete from the move collection. |
Initiate move pending | Delete from move collection. Delete anything created in the target region, including VM, replica disks etc. Infrastructure resources created during the move need to be deleted manually. |
Delete from move collection. |
Initiate move failed | Delete from move collection. Delete anything created in the target region, including VM, replica disks etc. Infrastructure resources created during the move need to be deleted manually. |
Delete from move collection. |
Commit pending | We recommend that you discard the move so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
We recommend that you discard the move so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
Commit failed | We recommend that you discard the so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
We recommend that you discard the move so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
Discard completed | The resource goes back to the Initiate move pending state. It's deleted from the move collection, along with anything created at target - VM, replica disks, vault etc. Infrastructure resources created during the move need to be deleted manually. Infrastructure resources created during the move need to be deleted manually. |
The resource goes back to the Initiate move pending state. It's deleted from the move collection. |
Discard failed | We recommend that you discard the moves so that the target resources are deleted first. After that, the resource goes back to the Initiate move pending state, and you can continue from there. |
We recommend that you discard the moves so that the target resources are deleted first. After that, the resource goes back to the Initiate move pending state, and you can continue from there. |
Delete source pending | Deleted from the move collection. It doesn't delete anything created in the target region. |
Deleted from the move collection. It doesn't delete anything created in the target region. |
Delete source failed | Deleted from the move collection. It doesn't delete anything created in the target region. |
Deleted from the move collection. It doesn't delete anything created in the target region. |
Move completed | Deleted from the move collection. It doesn't delete anything created in the target or source region. |
Deleted from the move collection. It doesn't delete anything created in the target or source region. |
SQL resource state after removing
What happens when you remove an Azure SQL resource from a move collection depends on the resource state, as summarized in the table.
Resource state | SQL |
---|---|
Added to move collection | Delete from move collection. |
Dependencies resolved/prepare pending | Delete from move collection |
Prepare in progress (or any other state in progress) |
Delete operation fails with error. |
Prepare failed | Delete from move collection Delete anything created in the target region. |
Initiate move pending | Delete from move collection Delete anything created in the target region. The SQL database exists at this point and will be deleted. |
Initiate move failed | Delete from move collection Delete anything created in the target region. The SQL database exists at this point and must be deleted. |
Commit pending | We recommend that you discard the move so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
Commit failed | We recommend that you discard the move so that the target resources are deleted first. The resource goes back to the Initiate move pending state, and you can continue from there. |
Discard completed | The resource goes back to the Initiate move pending state. It's deleted from the move collection, along with anything created at target, including SQL databases. |
Discard failed | We recommend that you discard the moves so that the target resources are deleted first. After that, the resource goes back to the Initiate move pending state, and you can continue from there. |
Delete source pending | Deleted from the move collection. It doesn't delete anything created in the target region. |
Delete source failed | Deleted from the move collection. It doesn't delete anything created in the target region. |
Move completed | Deleted from the move collection. It doesn't delete anything created in the target or source region. |
Next steps
Try moving a VM to another region with Resource Mover.