This guide describes how to export and import BACPAC files using Microsofts SQL Server Management Studio. Doing this is especially helpful to perform local backups or to setup a local development instance of an existing database.
The following software must be present at your client machine:
Other requirements are:
Exporting the database can be done using the UI of SSMS.
bacpac
file using the “browse” button within the wizard. Then follow the wizard until completion. For a full export, no additional settings are required.When exporting an Azure SQL Database and trying to import it into a local SQL Server (e.g. running in docker-compose), you need to make sure that the “Enabled Contained Databases” setting is set to TRUE
in your SQL Server properties. This is neccessary because Databases within Azure SQL PaaS are isolated using the “contained database” feature. Microsoft writes this:
A contained database is a database that is isolated from other databases and from the instance of SQL Server that hosts the database.
Experience shows, that this settings is by default off, at least for Linux container instances of MSSQL Server.
You can check if this feature is enabled by following these steps:
TRUE
If you do not want to keep this setting enabled after import, you can change it back to FALSE
as it is only needed for the import.
For further reading or more insights, here are the sources used for this guide.