Export Azure DB to BacPac file from .net application
If you want to automatize the backup of your Azure database on your own backup server, you can develop your own utility in few lines of C# code :
First you have to install SSMS 2012.
After, in your project, reference the assembly Microsoft.SqlServer.Dac.dll located in C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin.
Finally, you can export a bacpac file (containing both Schema and Data of your database) like this :
The connection string can be found on the Windows Azure Portal > SQL Databases > your_database > quick glance > Show connection strings > ADO.NET
#1
First you have to install SSMS 2012.
After, in your project, reference the assembly Microsoft.SqlServer.Dac.dll located in C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin.
Finally, you can export a bacpac file (containing both Schema and Data of your database) like this :
var ds = new DacServices("Server=tcp:your_server.database.windows.net,1433;User ID=your_user@your_server;Password=your_password;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;");
ds.ExportBacpac("test.bacpac", "your_database_to_export");
The connection string can be found on the Windows Azure Portal > SQL Databases > your_database > quick glance > Show connection strings > ADO.NET
#1
Comments