how to migrate an azure sql database to another subscription in the same tenant
Scenario: I have a database server with approximately 600 databases in subscription A , I want to migrate some databases to subscription B in multiple new resource groups in the same tenant. what are the best ways that involve less downtime
What I don’t want:
- I will not migrate the server just the databases.
- it is also not feasible to export bank by bank to storage acount and import the new subscription.
I thought of azure sql replication as a solution, but I didn’t find how to do it between subscription
New-AzSqlDatabaseSecondary -PartnerResourceGroupName $secondaryResourceGroupName -PartnerServerName $secondaryServerName
-PartnerDatabaseName $database.DatabaseName -SecondaryElasticPoolName $secondarypoolname
-ResourceGroupName $primaryResourceGroupName -ServerName $primaryServerName
-BackupStorageRedundancy $BackupRedundanceLocal `
-AllowConnections "All"
The items that I found on stackoverflow also migrate sql server and that I can’t do
2
Answers
Please go to the Resource Group and select the databases you want to move only.
Now select Move on the menu, and select "Move to another subscription".
how to move Azure resources to either another Azure subscription or another resource group under the same subscription is explained on Azure Knowledgebase. You can use the Azure portal, Azure PowerShell, Azure CLI, or the REST API to move resources.
You can check out this at
https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/move-resource-group-and-subscription