Friday, 31 July 2015

Deploy Azure DB via Web App – Using VS 2013 Release Management – Part 2 – Setup RM Component and Template to Deploy

In the Part 1 of this post, creating a web deployment package with dacpac, is explained. To deploy the dacpac to Azure DB via web deployment package, a Release Management template should be setup. The same component created in article “How to Deploy to Azure Websites with TFS build 2013 and VS Release Management 2013”, can be enhanced to deploy the database, using the dacpac file in web deployment package.
21
22 
In the Configuration Variables tab the newly added token __DemoAzureDBCon__ (adding the token in publish profile explained in Part 1) is set as a variable.
23
Next step is setting up an Azure DB. To do this create an SQL database in Azure management portal.
24
Select Create a new Azure DB server, to create a new DB server for Azure DB. Make sure to select Allow Azure services to access server option.
25
Database created in Azure with above options.
26
A web app in Azure is created to deploy the web application.
27
28
32
Copy the connection string (ADO.Net connection string) from the database connection strings and add it in the created web app settings, as a SQL Database connection.
28.1
Make sure to update the correct password to the connection string (Copied one has {your_password_here}).
Server=tcp:ch-demodbsvr01.database.windows.net,1433;Database=DemoAzureDB1;User ID=ch-dbsvradmin@ch-demodbsvr01;Password={your_password_here};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
28.2
In the Web App download the publish profile.
29
From the publish profile copy the values and set the parameters in the Release Management template.
30
  • WebAppName = Package zip file name (Package created with TFS build in Part 1).
  • PublishUrl = Publish Profile –> PublishUrl.
  • PublishUser = Publish Profile –> userName
  • PublishPassword = Publish Profile –> userPWD
  • AzureWebAppName = Publish Profile –> msdeploySite
  • DemoAzureDBCon = Publish Profile –> SQLServerDBConnectionString
31
With this template a release can be triggered using the build (Part 1).
33
Web Application gets deployed.
34

image
Database deployed with Web App.
35
Created Azure DB can be viewed in SQL Object Explorer in VS.
36
Allow the IP if prompt.
37
38
39

No comments: