Migrate using Windows PowerShell
- 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 Windows PowerShell.
Note: Instead performing your migration using Windows PowerShell, you also have the option to use Azure SQL migration extension for Azure Data Studio or Azure CLI.
-
Run PowerShell in Administrative mode.
-
Connect to Azure within the PowerShell session following the Microsoft instructions for the Connect-AzAccount command.
-
Set the Azure subscription to use in this session following the Microsoft instructions for the Set-AzContext command.
-
If you do not have a pre-configured database migration service set up and a 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 instructions for the New-AzDataMigrationSqlService command.
-
Get the authentication key for the self-hosted integration runtime following the Microsoft instructions for the Get-AzDataMigrationSqlServiceAuthKey command.
-
Register the database migration service following the Microsoft instructions for the Register-AzDataMigrationIntegrationRuntime command.
-
-
Create the database migration to the new Azure SQL Database following the Microsoft instructions for the New-AzDataMigrationToSqlDb command.