At Definitive Logic, our team is often tasked to work in technical environments that have layers of governance that, despite good intentions, place additional technical challenges on the team. Nevertheless, our team was up to the challenge and the following is our task, challenge, and solution (including the code) we would like to share with the rest of the Azure community.
Our team had to take a database export (.bacpac) file and import it into an existing database schema on Azure SQL Server.
The typical process to accomplish this requires you to have the ability to create a new database in the existing Azure SQL instance. This capability was not available to us and would have required an elevation of privileges request that would have taken several weeks of review, and possibly rejected. We scoured Microsoft documentation and the community pages and found that others had similar challenges, but no solution.
John Bonfardeci, a DL Azure Data Scientist and SQL expert, crafted a PowerShell script to import a database export into an existing database schema. This included John having to create some stored procedures that, if you are familiar with SQL Server on-premise, do not exist in Azure SQL’s master table. This proved very useful not only for our existing project but also for other projects that faced this similar challenge.
Since we saw that the Azure community was also experiencing this issue, we have made the PowerShell script and store procedures available on GitHub. If you would like to contribute to improvements to the script, simply fork the project and do a pull request.
As a Microsoft Gold Partner, Definitive Logic is committed to making Azure work for our customers. If you’re interested in how Azure can be leveraged in your organization, please contact us at firstname.lastname@example.org