How to Restore an Azure *.BACPAC File to Your Local SQL Server

As part of our build and deploy job in the user group project we create a backup of our Azure database before we run any data migrations. If something goes wrong, we do not lose any data and can restore our cloud database to a known good state.

It would be a great opportunity to take this backup file and restore our database to the local SQL Server on our developer machines. Unfortunately, the backup tool creates a *.bacpac file and not a *.bak. Restoring a *.bacpac file needs a few additional steps and, most importantly, a different entry point in the SQL Server Management Studio to start the restore process.

Instead of going to the database node and select “Restore Database…” from the context menu you need to select the entry Import Data-tier Application…:

Select Import Data-tier Application... in the same context menu you use to restore a database

This opens a wizard that will guide you through the restore process:

A little introduction to the wizard itself

On step two you can specify which file you want to restore:

Choose your BACPAC file to restore

In step three you can change the name of the restored database and choose a location for the data file path and the logs:

Choose the database name and the location of the data files and logs

On the summary screen is your last chance to check if everything is in order. If this is the case, you can start to restore your database. As soon as everything is done you get a success message and from now on your restored Azure database works like any ordinary database.

1 thought on “How to Restore an Azure *.BACPAC File to Your Local SQL Server”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.