Lesson Learned #25: Export/Import Azure SQL Database using Azure File Service?

In some situations, we need to import or export our Azure SQL Database using SQLPackage, but, unfortunately, either source and destination file we cannot specify a blob storage, in case that we want to save the file in this storage. For this reason, we have to use a local temporal folder for uploading/downloading the file depending on our needs.

However, we have an alternative, using Azure File Services. Once we have configured this we could use it as a local drive and use this for our SQLPackage.

For example, I create an Azure File Storage and I connect it using the following command:

  • net use f: \\myfile.file.core.windows.net\mysqlpackage /u:useraccount mykey
  • Once we have specified this network drive we could use sqlpackge, like this one to import our data. sqlpackage.exe /a:import /sf:f:\data.bacpac /tdn:mydb /tsn:myserver.database.windows.net /tp:password /tu:user

Enjoy!