1
votes

While working in MVC/ C# with Azure I need to restore database from a .bacpac file which is stored in blob storage. I m using DAC Framework API to access .bacpac from Blob storage.

Issue:

DacServices.ImportBacpac requires .bacpac file, I am able to refer blob file (which is a .bacpac) but it comes as a blob and not as a .bacpac file. I m not sure how to convert a blob to a .bacpac. Can you please guide me some way or API to do that conversion ? Later I will use this file to import backpac to SQL Server Azure.

Thanks for your time and help.

1

1 Answers

3
votes

The best way is probably to read the blob as a stream (CloudBlob.DownloadToStream()) and create the bacpac from said stream (BacPackage.Load()).