What's the most automatic way to restore a on-premise SQL Server database to Azure SQL Database?

Has anybody done or seen such a solution?

Need to do a weekly refresh of a dev database from on-premise to Azure SQL Database with overwrite.


You can use SqlPackage.exe to create a BACPAC file. You can then use SqlPackage.exe to import the BACPAC into Azure SQL Database.

You can also script it using PowerShell and automate it in Azure using a PowerShell Runbook, or use SQL Agent on-prem to automate it.

The basic process you need to follow, regardless of whether you use SqlPackage.exe or PowerShell, is as follows:

  1. Export the BACPAC from SQL Server using SqlPackage.exe or Powershell.
  2. If required due to security restrictions, upload the BACPAC file to Azure storage so that it can be accessed for the import, or run it from an intermediate location that can access both source and destination locations.
  3. Import the BACPAC using SqlPackage.exe or Powershell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.