DotNetCurry Logo

DevOps Project in Azure – Automating CI/CD Pipeline on VSTS

Posted by: Subodh Sohoni , on 12/6/2017, in Category Microsoft Azure
Views: 2624
Abstract: A walkthrough of the DevOps Project service of Azure to automatically create a CI / CD pipeline in VSTS for a containerized ASP.NET Core application

Microsoft has added a new service to Azure that supports DevOps teams to automate the CI / CD Pipeline creation.

This service is called the DevOps Project.

This service provides the automation of the following items from the Azure portal:

  • Creation of Team Project if it does not already exist.
  • Creation of a source repository in the existing team project.
  • Creation of a build definition that has a trigger for Continuous Integration.
  • Creation of a release definition that has triggers for Continuous Deployment.
  • Create initial code as per selected project type and add it to repository of version control.
  • Create any additional Azure resources that may be necessary to support the CI / CD pipeline.

In this article I am going to walk you through the steps of creating a DevOps Project so that all these automation steps are executed.

I am going to take a case of an ASP.NET Core application that is deployed on an Azure App Service as a Web Application in the containers.

What you will get as an output is a CI / CD pipeline for this application, an image of the application that can be used by the container service, Azure Container Registry that will store this image and the Web Application on the Azure App Service.

Creating a DevOps Project

For this walkthrough, let us begin by opening the Azure portal. I assume that you have an Azure subscription. If you do not have an Azure subscription, you can create one for free (with a credit of USD 200 to be utilized in 1 month) from https://azure.microsoft.com/en-in/free/

In the Azure portal, click the button for +New and in the search box, type in DevOps Project. Select the DevOps Project from the drop down that appears.

new-devops-project

Doing so starts a wizard to fetch the details for creation of DevOps project. Click on the Create button in this wizard.

create-devops-project

Now we can select the application technology we want to deploy. DevOps Project gives us a number of options:

1. .NET Applications

  • ASP.NET
  • ASP.NET Core

2. Java Web App

  • Spring
  • JSF

3. Static Web Site

4. Node.js

  • Express.js
  • Sails.js

5. PHP

  • Laravel
  • Symphony

6. Python

  • Bottle
  • Django
  • Flask

Deploying an ASP.NET Core application to Azure service

For this walkthrough, I have chosen to use an ASP.NET Core application that can be hosted in the containers.

technology-selection

framework-selection

The wizard now allows us to select an Azure Service to which we will deploy our application. The options are:

1. Web App on Windows

2. Web App on Linux

3. Web App for Containers

azure-service-selection

On the next page, we have to provide details of the VSTS and Azure subscription.

I have selected to use my existing VSTS and Azure subscriptions but have given a name of a team project which does not exist, so that it will be created.

vsts-and-azure-subscription-details

Once we click on the Done button, it starts the process of creating the Team Project, code, version control repository, build definition, release definition, Docker Image, Azure Container Registry, push the image to that registry, Azure App Service application with containers support and run that image on that app.

It also adds the support of Application Insights to this application.

After the wizard has completed processing all that, it sends out an email to confirm that application is deployed and running.

Viewing artifacts created by DevOps project

The page in the Azure portal shows all the artifacts the DevOps Project has created and also all the Azure resources created.

devopsproject-resources-created

We can see the code under version control of that team project.

devopsproject-created-code

We can also view the created build definition

devopsproject-ci-build-process

That build definition is configured to run on a Hosted Linux agent. It contains a task for building the image from the Docker file that is automatically created.

Pushing the image to Azure Container registry

The next task is to push that image to the created Azure Container Registry.

build-image-1

push-image-task

The connection to Azure is made by a service endpoint which is also created automatically.

azure-service-endpoint

Let us now look at the created release definition. It contains the task for deployment of the app to the Azure App Service from Azure Container Registry.

deploy-azure-app-service

As part of the completed wizard, the build and release are automatically triggered. At the end of the deployment, the application is running and we can view it.

azure-app-service-deployed

Resources created by the DevOps Project Wizard

At the end let us view the resources created by the wizard.

The first is the Azure App Service where the ASP.NET Core Application is deployed.

azure-app-service

We can also view the Azure Container Registry created by the wizard.

azure-container-registry

Conclusion

In this article, we took a walkthrough of the DevOps Project service of Azure to automatically create a CI / CD pipeline in VSTS for a containerized application.

Was this article worth reading? Share it with fellow developers too. Thanks!
Share on LinkedIn
Share on Google+
Further Reading - Articles You May Like!
Author
Subodh is a consultant and corporate trainer. He has overall 28+ years of experience. His specialization is Application Lifecycle Management and Team Foundation Server. He is Microsoft MVP – VS ALM, MCSD – ALM and MCT. He has conducted more than 300 corporate trainings and consulting assignments. He is also a Professional SCRUM Master. He guides teams to become Agile and implement SCRUM. Subodh is authorized by Microsoft to do ALM Assessments on behalf of Microsoft. Follow him on twitter @subodhsohoni


Page copy protected against web site content infringement 	by Copyscape




Feedback - Leave us some adulation, criticism and everything in between!