Continuous deployment, or CD, is an imperative piece of any DevOps pipeline. CD is when an automated deployment starts as soon as a build successfully completes. In this post, we will discuss how to set up continuous deployment to an Azure SQL Database using Release Management in VSTS and TFS 2015-2018.
Get Started
Before you can begin, you will need two things: a CI build that publishes your SQL server package and an Azure SQL Database. To learn how to set up continuous integration, read the Microsoft documentation. To learn about Azure SQL Databases and how to create one, visit this documentation. Once you have both of these pieces, you’re ready to set up your Continuous Deployment process.
Setting Up Your CD Process
This CD release process will pick up the artifacts created by your CI build and deploy them into the Azure SQL Database you created. To begin creating this process, you must first create a release definition. In the build summary of your CI build, choose Create Release under Deployments. Otherwise, you can open the Releases tab of the Build & Release hub and choose + New definition on the page that appears.
Select the Empty process template. In the Artifacts section, be sure your CI build definition that publishes the DACPAC is selected as the artifact source. Select the Continuous deployment checkbox, then select Create.
Configure Your SQL Database
After your release definition has been created, add a SQL Database task to the default environment. Now you’ll need to configure this task as shown here:
Now, simply edit the release definition name and click Save. You can also change the name of your default environment.
Create a Release
You’re now ready to create a release. A release starts the process of running the release definition with the artifacts produced by a specific build. In this case, this release will result in deploying the DACPAC to Azure SQL Database. To begin, select Create Release from the +Release menu. Select the CI build you just completed and click Create. You’ve successfully created your release!
You can also select the release link that will appear in a popup message. The message text will look something like this: “Release Release-1 has been created.” Next, open the Logs tab to watch the output of the release console as your release runs.
For more information on this type of database deployment, check out the documentation here. If you want to deploy to a SQL server on-premises, we have you covered with a deployment task created by us here at PRAKTIK. You can also contact our team of experts for further details.