Migrate using Azure CLI
- Last UpdatedNov 05, 2025
- 1 minute read
After you complete the pre-migration tasks, follow the steps below to migrate your on-premises SQL database to Azure SQL Database using Azure Command Line Interface (CLI) .
Note: Instead performing your migration using Azure CLI, you also have the option to use Azure SQL migration extension for Azure Data Studio or Windows Powershell.
-
Open PowerShell in Administrative mode.
-
Download and install the Azure CLI utility. Refer to Azure Command-Line Interface (CLI) for install instructions.
-
Connect to Azure within this PowerShell session following the Microsoft documentation for the az-login command.
-
Set the Azure subscription that you want to use following the Authenticate to Azure using Azure CLI instructions.
-
If you do not have a pre-configured database migration service and self-hosted Integration Runtime agent, enter the following commands to configure the service and agent:
-
Download the Microsoft Integration Runtime.
-
Create the Database Migration Service following the Microsoft documentation for the az datamigration sql-service create command.
-
Get the authentication key for the self-hosted integration runtime following the Microsoft instructions for the az datamigration sql-service list-auth-key command.
-
Register the database migration service following the Microsoft instructions for the az datamigration register-integration-runtime command.
-
-
Create the database migration to the new Azure SQL Database following the Microsoft instructions for the az datamigration sql-db create command.