I’ve recently been involved in a manual migration of multiple subscriptions from a tenant to another due to an organization change and one of the components that I was responsible for was the migration of the Azure SQL Databases. I had originally hoped that I would be able to use the DMA (Data Migration Assistant) but attempting to select an Azure SQL Database as a source would throw an error indicating it was not supported. Given that there weren’t too many databases and there were only 2 that would require an outage, we decided that we’ll perform an export/backup of the databases to a storage account and then import/restore them in the destination subscription.
While it is possible to manually export them via the GUI:
A more efficient way was to use PowerShell to export all of the subscription’s databases and its properties into an Excel file, update the Excel file with the SQL credentials, then use PowerShell to read through the Excel spreadsheet to export/backup the databases to a Storage account.
The PowerShell script I created that will export all of a subscription’s Azure SQL Database properties can be found here: https://github.com/terenceluk/Azure/blob/main/PowerShell/Export-All-Subscriptions-AzureSQLDatabases-To-Excel.ps1
The following screenshot is an example of the export:
Assuming that each database has different credentials, add the additional columns to store the SQL Authentication username and password:
With the spreadsheet updated, we can now use this PowerShell script export/backup all of a subscription’s Azure SQL Database to a storage account container: https://github.com/terenceluk/Azure/blob/main/PowerShell/Backup-AzureSQLDatabases.ps1
Hope this helps anyone who might be looking for a way to automate the process of exporting a subscription’s Azure SQL Database to Excel and then using the list to backup the databases.