In this section, we are going to see how to export dacpc file from SQL Server or Visual Studio and import the same in Azure. This is really important step and definitely you are going to need this, if you are writing some sort of data driven app and which needs to be deployed on Azure SQL. This step is also going to help you with containerizing SQL. There are two kinds of file format dacpac and bacpac. And the basic difference is dacpac copies only schema and bacpac copies both schema and data as well. In this post, we are going to see dacpac.
Let’s get started. I have a sample project as shown below and here, I can either download it either via Visual Studio or via SQL Server Studio itself.
I am doing it VS way. Here, I will provide the path and click OK.
Upon, clicking OK, this task will get started as shown below. And, in some time it gets finished as well.
Now, Let’s go ahead in Azure portal and search for Azure SQL and create new server with below details. This is pretty straight forward, nothing fancy.
I have chosen the basic plan to avoid hammering on my credit card.
Here, in this wizard, I am just going to provide below details as presented.
This is important. Here, we need to make sure that networking is enabled for public endpoints so that you can access resources from internet. Also, I made sure Azure services to access this server and added my current IP address under whitelist IPs.
Other things are just usual, so you can continue as is.
Finally, review screen will present all the required details.
Upon successful creation, I can go ahead and connect to the SQL server. And, here I can just see that movies db is created. Currently, this is just the skeleton one. But, we can
Last but not the least, we can have our github action something like
This will make sure, it connects our SQL Server via build pipeline and deploys the recently created dacpac to Azure SQL. Therefore, whenever any change in db schema will happen, this will pickup and deploy the same to Azure SQL. You can off-course build your actions differently also as per your need. But, more or less logic revolves around the same.
Thanks for joining me. Stay tuned and Happy coding.
565 total views, 3 views today