As a TSP in DX at Microsoft, I am constantly asked to talk about DevOps and what DevOps means for Microsoft. Although there are many definitions of DevOps floating out in our industry, at Microsoft, DevOps is the merging of people, process and products such that we can continually deliver value to our end users. And clearly, VSTS/TFS and Azure are the products which enables this whole DevOps mindset.
Randy Pagels and I created a DevOps demo which show how VSTS/TFS and Azure can do this. For the next couple of blogs, I will walk you through how to set up our DevOps demo using an asp.net website backed by sql server hosted in Azure. Source control, work item tracking, CI builds and CD pipelines , unit tests, automated ui tests and load tests are all done using VSTS.
All artifacts for this blog series can be found here: https://github.com/abelsquidhead/MercuryHealth
Randy Pagels has written up the actual demo script we use with this demo environment. You can read through the demo script here: http://www.teamsystemcafe.net/WhatsBrewing/Edit/38
Table Of Content
Part 1: Setting up your Azure PaaS Environment
Part 2: Setting up your VSTS Team Project
Part 3: Setting up your Git Repo
Part 4: Setting up your Build
Part 5: Setting up your Release Pipeline
Overview
Dev Ops is the hot buzz word of the moment and everyone wants to see how Microsoft addresses Dev Ops. However, when you ask 10 people what Dev Ops is, you will get 10 different responses. Here at Microsoft, Dev Ops means one thing. It is the merging of People, Process and Products such that we can continually deliver value to our end users. On the people side, this means breaking down walls between dev teams, qa teams and ops teams. Instead of three separate teams, have one team with everyone hyper focused on one goal, to continually deliver value to our end users. Teams have become far more cross functional. As dev, our roles have changed. Instead of just implementing a user story and throwing a build over the fence to QA, we are now responsible for implementing the user story, writing full coverage with unit tests for that user story and either working with QA to write UI automation or writing the UI automation ourselves to test the User Story. This way, we can iterate fast enough and catch regression bugs without the need for months of regression testing by a human. We’re also working hand in hand with the Ops folks to figure out what is the best way to consistently and quickly deploy our applications. For process, there needs to be a process in place which will let teams iterate fast enough, produce code of high enough quality and a way to deliver the application to the end users quickly and consistently. Agile processes (done correctly) work great, although they are not the only processes. And finally, for products and tooling, the answer is clearly TFS/VSTS and Azure. With TFS/VSTS and Azure, Microsoft is the only vendor that can provide you with the full DevOps stack. This blog post provides an end to end demo which demonstrates Microsoft’s vision of using TFS/VSTS and Azure to achieve DevOps nirvana.
From a high level, this demo involves an asp.net web app using a sql server back end. A bug is detected and work is assigned to a developer in TFS. The developer opens visual studio, fixes the bug, updates unit tests and automated tests, checks in his work while associating the check in with the bug. Once checked in, this triggers a code review. When the code review passes, the code is merged into the master branch where a CI build is kicked off. This builds runs all unit tests. If the build passes, a Release Management pipeline picks up this build and releases the application (both web and db schema) to a Dev environment, QA environment and all the way to a production Environment. Releases can run automated tests, load tests and whatever else is necessary. Environments use Azure PaaS.
Setup
This demo involves 5 major parts which need to be setup and configured:
- Azure PaaS environments
- VSTS team project.
- Git Repository
- Build
- Release Pipeline
Azure PaaS Environments
Azure PaaS is used to host the web apps and databases for each environment. A web app with deployment slots for each environment is used with separate instances of Azure Sql for the database.
Create Resource Group for demo environments
- Launch Azure Portal and click on Resource Groups
- Click Add
- Enter a name for the new resource group, select subscription and resource group location and click Create.
- This will create your resource group and take you to the Resource Group blade. Stay on this blade and go on to the next section.
Setting up Azure Databases for each environment
Because we will be using Sql Server Data Tools Database projects in our solution to deploy our database schemas, we need to create a V12 db server. Unfortunately, at the time of the writing of this paper, creation of V12 db servers always fail. This means we cannot just choose to create a Web App + SQL (the DB creation will fail) so in order to work around this, we will manually create an old version V2 DB server, then manually upgrade it to a V12 server, and then create the Web App.
Creating the DB and DB server for the Prod environment
- Click Add
- In the search field, type in sql and select SQL Database
- Click on SQL Database
- Click Create
- Enter name of your database, then click on Server Configure required settings
- Click Create a new server
- Enter server name, admin login, admin password twice, select Location and click No for Create V12 Server and then click OK
- Chose blank database for Select source, Standard S0 for pricing tier, Optional Configuration Collation and click Create
- After a couple of minutes, this will create the blank SQL server and SQL db and route to the DB blade. Click on the db server link to upgrade the db server to v12
- Click on V2, the Server version
- Click on Upgrade this server
- Type the name of the database server in the server name field and click OK
- Upgrading the DB takes a bit of time so kick back and relax until the process is done.
Creating the DB for the Dev environment
- Go to the blade of your resource group and click Add
- Type sql in the search field and select SQL Database
- Click SQL Database
- Click Create
- Enter name for your dev instance of your DB and click Server Configure required settings
- Under Use an existing server, select the server you just created in the section above and click Select
- Click Create
- Wait for the DB creation to finish
Creating the db for the QA environment
- Browse to the blade of your resource group and click Add
- In the search field type in sql and select SQL Database
- Click SQL Database
- Click Create
- Enter the name for your qa database and click Server Configure required settings
- Under Use an existing server, select the DB server we created earlier and click Select
- Click Create
- Wait for the creation of the QA database to finish
Setting up the Web App with deployment slots
Creating the Web App for the PROD environment
- Browse to your resource group blade and click Add
- Scroll down a bit and click Web App
- Click Create
- Enter the name for your web service, select the subscription, select the resource group we just created and create a new app service plan using the S1 plan and click Create
- Wait for Web App Service to complete.
Creating web app deployment slots for the DEV environment
After creating the Web App, we now need to configure the deployment slots to be used by the Dev and QA environments.
- Browse to the blade of your resource group and select the web app you just created
- Scroll down and select Deployment slots under PUBLISHING on the right hand side
- Click Add Slot
- Type Dev for the name and click OK
- Wait for deployment slot to be created
Creating Web App deployment slot for the QA environment
Creating Web App deployment slot for the BlueGreen environment
- Click Add Slot
- Type in BlueGreen for the name and click OK
- Wait for BlueGreen deployment slot to finish
Setting up sticky Web App configuration for DEV, QA and PROD environment
Next, we will set up the sticky configuration for the web app and the deployment slots by setting the DefaultConnection connection string. First we will copy the connection string for the corresponding DB, then we will set the connectionstring
Setting up sticky configuration for PROD environment
- Browse to the Resource Group blade and click on the DB for production
- Click on Show database connection strings
- Copy the ADO.NET connection string. Be sure to replace the password, i.e. “Password={your_password_here}”, with the password you set, them browse back to the resource group blade
- Click on the Web App
- Click on Application settings
- Scroll down to the Connection strings section and enter DefaultConnection for the name, the connection string that you copied above (including the password you selected earlier) in the Value field, select SQL Database in the drop down and click Slot setting checkbox. Under the App settings area type in MyWebSlot, then BlueGreen for the value and check Slot Setting box and click save.
Setting up sticky configuration for BlueGreen environment
- Browse to the Resource Group blade and click on the DB for production
- Click on Show database connection strings
- Copy the ADO.NET connection string. Be sure to replace the password, i.e. “Password={your_password_here}”, with the password you set, them browse back to the resource group blade
- Click on the BlueGreen Web App
- Click on Application settings
- Scroll down to the Connection strings section and enter DefaultConnection for the name, the connection string that you copied above (including the password you selected earlier) in the Value field, select SQL Database in the drop down and click Slot setting checkbox. Underthe App settings area type in MyWebSlot, then BlueGreen for the value and check Slot Setting box and click save.
Setting up the sticky configuration for the DEV environment
- Browse to the Resource Group blade and click the DEV database
- Click on Show database connection strings
- Copy the connection string under ADO.NET, replace the password, i.e. “Password={your_password_here}”, with the password you created earlier and browse to the Resource Group blade
- Click on the Dev slot
- Click on Application settings
- Scroll down to the Connection strings section and enter DefaultConnection for the value, copy the connection string (including your password) in Value, SQL Database in the drop down and click Slot setting checkbox. Under the App settings area type in MyWebSlot, then Dev for the value, check Slot Setting box and then click Save.
Setting up the sticky configuration for the QA environment
- 1. Browse to the Resource Group blade and click on the QA database
- 2. Click on Show database connection strings
- 3. Copy the connection string under ADO.NET, replace with your password and browse to the Resource Group blade
- 4. Click on the QA deployment slot
- 5. Click on Application settings
- 6. Scroll down to the Connection strings section and enter DefaultConnection for the Name field, copy the connection string (including your password) into the Value field, select SQL Database in the drop down and click the Slot setting checkbox. Under the App settings area type in MyWebSlot, then QA for the value, check Slot Setting box and then click the Save button.
Setting up Application Insights
Creating a web app automatically sets up Application Insights for you. Browse to the Resource group blade and you will see the Application Insights with the same name as your website
Next up, part 2. Setting up your VSTS project.
Graham Smith
Hi Abel
In my blog series on Continuous Delivery with TFS / VSTS I’m encouraging Infrastructure as Code and Server Configuration as Code with PowerShell DSC rather than clicking through GUIs
Cheers – Graham
abel
Hi Graham. Man, what a great series on infrastructure as code and configuration as code. Even though I’m not using any VM’s, we can use ARM templates to define Azure PaaS (my web app, deployment slots and database)(https://azure.microsoft.com/en-us/documentation/articles/app-service-web-arm-with-sql-database-provision/). I don’t think DSC has a play here though (since there are no machines to configure). Although for setting up a demo, I don’t mind clicking through guis…
Graham Smith
Thanks for your kind words Abel. Kudos to you for setting a new world record for the most screenshots in a blog post. :). I know how long it can take!
Yes – one of the nice things about PaaS is that the server config is taken care of and no need for DSC. I do wonder how many brownfield organisations are actually in this lucky position though – certainly not where I work.
All the best!
Cheers – Graham
Donovan
Abel does use a lot of screenshots!
Randy Pagels
Hi Graham, nice to meet you. I also enjoyed reading your Continuous Delivery with TFS / VSTS blog series. I’d like to give all this a try next.
LOL about Abel’s world record. Too funny.
I’ll be blogging on the actual “giving the demo” walkthrough series, something I worked on with Abel. You’ll see it soon here: http://www.teamsystemcafe.net/WhatsBrewing/Details/36
Randy
Graham Smith
Hi Randy
Great to meet you too. Love your site and very much looking forward to your DevOps blogs! I’m currently researching deploying my sample web app and database with the web-based Release Management and DSC. I’m having a blast! Well mostly – few hiccups but nothing serious. I’ll be posting about this in the next week or so if all goes to plan.
Cheers – Graham
Setting up a DevOps demo using VSTS and Azure (Or DevOps Nirvana with VSTS and Azure), Part 3/5
[…] Part 1: Setting up your Azure PaaS Environment […]
Setting up a DevOps demo using VSTS and Azure (Or DevOps Nirvana with VSTS and Azure), Part 2/5
[…] Part 1: Setting up your Azure PaaS Environment […]
Setting up a DevOps demo using VSTS and Azure (Or DevOps Nirvana with VSTS and Azure), Part 4/5
[…] Part 1: Setting up your Azure PaaS Environment […]
Setting up a DevOps demo using VSTS and Azure (Or DevOps Nirvana with VSTS and Azure), Part 5/5
[…] Part 1: Setting up your Azure PaaS Environment […]