Team Services | TFS 2017 | TFS 2015 | Previous versions
Continuous deployment means starting an automated deployment process whenever a new successful build is available. Here we'll show you how to set up continuous deployment of your database packaged as a DACPAC to an Azure SQL Database using Release Management.
Get set up
Begin with a CI build
Before you begin, you need a CI build that publishes your SQL server package. To set up CI, see:
Azure SQL Database
Carry out the following steps to set up an Azure SQL Database server to which the DACPAC of the database will be deployed.
Sign into the Azure management portal and choose the +New icon in the left panel, then choose Data + Storage. Select SQL Database from the list.
In the SQL Database blade, enter a name for Azure SQL Database and then choose Server to configure the required settings for the server.
In the Server blade, choose Create a new server.
In the New server blade, enter a name for the server and enter the admin login and password for the new server. Leave all other settings as they are and choose OK.
Back in the SQL Database blade, leave all the other settings at their default values and choose Create.
After the Azure SQL Database server and database have been created, open its blade and make a note of the Server name.
Define and test your CD release process
Continuous deployment (CD) means starting an automated release process whenever a new successful build is available. Your CD release process picks up the artifacts published by your CI build and then deploys them to your database.
Do one of the following:
If you've just completed a CI build (see above) then, in the build's Summary tab under Deployments, choose Create release followed by Yes. This starts a new release definition that's automatically linked to the build definition.
Open the Releases tab of the Build & Release hub, open the + drop-down in the list of release definitions, and choose Create release definition.
Select the Empty template and choose Next.
In Source... make sure your CI build definition that publishes the DACPAC is selected as the artifact source.
Select the Continuous deployment check box, and then choose Create.
Add a SQL Database task to the default environment and configure it as follows:
Deploy: Azure SQL Database Deployment
Deploy the database to Azure SQL Database.
- Azure Connection Type:
Azure Resource Manager.
- Azure Subscription: Select an Azure subscription.
- Azure SQL Server Name: Enter the name of the SQL Database server you created earlier.
- Database Name: Enter the name of database.
- Server Admin Login: Enter the admin user name for your SQL Database.
- Password: Enter the admin password for your SQL Database. To hide the password, create a variable for it in the environment.
- Firewall | Specify Firewall Rules Using:
- Azure Connection Type:
Edit the name of the release definition, choose Save, and choose OK. Note that the default environment is named Environment1, which you can edit by clicking directly on the name.
You're now ready to create a release, which means to start the process of running the release definition with the artifacts produced by a specific build. This will result in deploying the database DACPAC to Azure SQL Database:
Choose + Release and select Create Release.
Select the build you just completed in the highlighted drop-down list and choose Create.
Choose the release link in the popup message. For example: "Release Release-1 has been created".
Open the Logs tab to watch the release console output.