Doing it via the Portal

I’m trying to backup our SQL Azure database, and to my surprise, it doesn’t seem to be “straight forward”. Officially, you have to do it via the Azure portal (or Azure CLI), but I find the process a bit overwhelming for simple backup of “I just want the file”.

If you do it via the portal, you have to go to the Database instance, and click on Export.

Then fill up the destination value.

Wait for the process to finish, and then download the file on that Azure storage. I personally think this is the preferred approach when the database file is very big that it doesn’t make sense to download locally.

On some cases, you just need a copy of the database, so that either developers can interface and make APIs faster on their local machines.

Doing it via Azure Data Studio

I looked both [[Azure Data Studio]] and [[SQL Server Management Studio (SSMS)]] but to my surprise, Azure SQL backup doesn’t work just like how you do it on local DB (docker/sql express) as well as on-premises databases.

Good thing, there is this SQL Server dacpac extension . This gives you other import/export functionalities that are supported to almost any version of SQL databases that supports BACPAC.

After installing the extension, right click on the Azure SQL Database that you want to export and select “Data-tier Application Wizard”:

Select the 4th option (Export both schema and data as .bacpac)

Complete the wizard (choose file location) and confirm.

It will then download a bacpac of your Azure SQL Database!

Doing it via SQL Server Management Studio (SSMS)

Connect to the Azure SQL database via SSMS.

Right click on the database and select “Generate Scripts…”

Choose the objects that you want.

Select the scripting options. If you want to include the data, go to “Advanced”

On the types of data to script, choose “Schema and Data”

It will then create a SQL script of your database.

The good thing about this approach is that you can modify the script in case you have other features that are only applicable to certain SQL type such as Ledger capabilities.

This is not recommended if your database is huge and contains a lot of data.