Is it possible to update the existing Azure SQL Database using bacpac?
No, it is not possible to restore a bacpac file to an existing Azure SQL database. A bacpac file is a data-tier application package that contains the schema and data of a SQL Azure database.
For the reason explained above you can restore a bacpac on an existing database if the database is empty only.
byte[] bacpac = File.ReadAllBytes(@”<local_bacpac_filepath>”);
// restore what we have on production
using (MemoryStream ms = new MemoryStream(bacpac))
{
BacPackage package = BacPackage.Load(ms);
DacServices services = new DacServices("<connection_string>");
services.ImportBacpac(package, "<existing_database_name>");
}
If you want to overwrite an existing database with the data from a bacpac file, you have to first delete the existing database and then import the bacpac file with the same name as the deleted database.
Read more here: Source link
