When you transfer Azure resources between subscriptions, you might get the following error: “ResourceNotTopLevel“.
This is caused by the fact that you only have to select top-level resources for the move, and the dependencies will be moved automatically.
For example, say you selected both a Network Watcher Extension and the relative VM you want to move. You will just need to move the VM object, and the extension will come with the server.
Example of an error code:
{
"code": "ResourceNotTopLevel",
"message": "Identifier '/subscriptions/0000000000000000000/resourceGroups/MoveResource/providers/Microsoft.Compute/virtualMachines/VMtobeMoved/extensions/AzureNetworkWatcherExtension' is not a top level resource. Please include only the top-level resource for this child resource in the move request. A child resource would be moved along with its associated top-level resource.\""
}
From the error code, you’ll get that you just have to move the following resource, being the top-level one:
/subscriptions/0000000000000000000/resourceGroups/MoveResource/providers/Microsoft.Compute/virtualMachines/VMtobeMoved
It’s good to remember that if dependent resources are distributed across different resource groups, you’ll first have to move them into one resource group and then attempt the migration.