I have a set of Coded UI tests which run on a daily basis via VSTS. One pre-requisite of this test plan is that a BACPAC be imported to the SQL server. In order to meet this, I created a test method which imports the BACPAC using the Microsoft.SqlServer.Dac.DacServices.ImportBacpac method, included the test in a test suite and then executed that test suite via a Run Functional Test task in the build definition.
Recently the database was moved to Azure and therefore this test is failing with the following message:
Microsoft.SqlServer.Dac.DacServicesException: Data cannot be imported into target because it contains one or more user objects. Import should be performed against a new, empty database. Error SQL0: Data cannot be imported into target because it contains one or more user objects. Import should be performed against a new, empty database.
A Request To The Veterans
Before I get to my question I would like to mention that my experience with Azure is currently nil and I hope you will excuse me if I ask anything that should have been obvious.
Question
Is there a way for me to import the BACPAC to Azure programmatically (similar to my existing approach)? Or is it a better idea to use Azure SQL Database Deployment task? Or is there another approach that you would recommend?