Move Azure Resource Manager resources between subscriptions

Updated 13/6: VPN gateways and VM Scale Sets can be moved between subscriptions now.

Setting the scene

I’ve previously covered how to move Azure resources between Resource Groups, and how to migrate from Azure Service Management to Azure Resource Manager, so now it’s time to take the next step: Moving to a new subscription. As I covered yesterday, this is the natural step for a lot of companies, as they want to move to CSP billing.

The scenario I want to go through today, is not based on an environment that was migrated from ASM to ARM, because, Key Vault stuff. Read yesterday’s post for more info 😉 Instead I’ll focus on a pure ARM based solution, with the following components:

  • 1 Virtual Network
  • 2 Storage Accounts – 1 Premium and 1 Storage
  • 2 VMs – 1 on Premium Storage, and 1 on Standard

For fun, the subscription I’m moving from, is a Pay-as-you-Go and the destination is an MSDN subscription, on our Enterprise Agreement.


  • The 2 subscriptions must be within the same Azure AD Tenant
  • Currently we can’t move VPN Gateways, VM Scale Sets, Recovery Services Vaults, ExpressRoute, and a few other resources, between subscriptions
  • Resources that are connected, must reside in the same Resource Group – you can’t move a Virtual Network, without the connected VMs and vice-versa’


  1. Ensure that the needed Resource Providers are registered on the destination subscription. If they’re not registered, you will get an error telling you to register them. This script will do that for you:[powershell]
    $cred = Get-Credential
    Login-AzureRmAccount -Credential $cred

    $oldSubscription = "Cloudpuzzles" #Name of source susbcription
    $newSubscription = "Jesper Jensen MSDN" #Name of destination subscription
    $sourceRG = "SubscriptionTest" #Name of ource Resource Group
    $destinationRG = "" #Name of destinatino Resource Group

    #Get Resource Providers
    Select-AzureRmSubscription -SubscriptionName $oldSubscription | Out-Null
    $resources = Find-AzureRmResource -ResourceGroupNameContains $sourceRG
    $resourceProviders = @()
    foreach ($resource in $resources) {
    $resourceProvider = ($resource.ResourceType).Split("/")[0]
    if ($resourceProviders -notcontains $resourceProvider) {
    $resourceProviders += $resourceProvider

    Write-Output "Found these providers:"
    Write-Output $resourceProviders
    Write-Output "Moving on to registration"

    #Register Resource Providers on destination subscription
    Select-AzureRmSubscription -SubscriptionName $newSubscription | Out-Null
    foreach ($provider in $resourceProviders) {
    if ((Get-AzureRmResourceProvider -ProviderNamespace $provider).RegistrationState -ne "Registered") {
    Write-Output "$provider not registered, registering…"
    Register-AzureRmResourceProvider -ProviderNamespace $provider
    while ((Get-AzureRmResourceProvider -ProviderNamespace $provider).RegistrationState -ne "Registered") {
    Write-Output "Waiting for registration…"
    Start-Sleep -Seconds 2
    elseif ((Get-AzureRmResourceProvider -ProviderNamespace $provider).RegistrationState -eq "Registered") {
    Write-Output "$provider already registered, continuing…"

  2. Check that the resource you want to move, is actually supported:
  3. Make sure you create the destination Resource Group before moving – it won’t work otherwise

Move with Azure Portal

After you login to Azure, find your Resource Group:


Next, click the pen right next to your subscription name:


On the next blade, check that all your resources are there. Then select the destination Subscription and Resource Group:


That’s it, now you just need to wait. Or check this video to see it work – and notice I have rdp sessions open all the time, no downtime!

Move with Azure PowerShell

Moving resources with PowerShell, is soooo easy:

$cred = Get-Credential
Login-AzureRmAccount -Credential $cred

$oldSubscription = "Jesper Jensen MSDN" #Name of source susbcription
$newSubscription = "Cloudpuzzles" #Name of destination subscription
$sourceRG = "DestinationSubsctiptionTest" #Name of ource Resource Group
$destinationRG = "SubscriptionTest" #Name of destinatino Resource Group

#Get resources
Select-AzureRmSubscription -SubscriptionName $oldSubscription
$resources = Find-AzureRmResource -ResourceGroupNameContains $sourceRG
$subscriptionID = Get-AzureRmSubscription -SubscriptionName $newSubscription

#Move resources
Move-AzureRmResource -DestinationSubscriptionId $subscriptionID.SubscriptionId -DestinationResourceGroupName $destinationRG -ResourceId $resources.ResourceId -Verbose

This will warn you:



And start the migration!

Closing notes

As you can see, this is very easy. All we need now, is a fix for the ASM to ARM migrated resources, and we can start moving customers around (to CSP of course!). Happy moving 🙂

Leave a Reply

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

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

Facebook photo

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

Connecting to %s