DevOps Project in Azure – Automating CI/CD Pipeline on VSTS
Posted by: Subodh Sohoni ,
on 12/6/2017,
in
Category DevOps
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.

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

Now we can select the application technology we want to deploy. DevOps Project gives us a number of options:
1. .NET Applications
2. Java Web App
3. Static Web Site
4. Node.js
5. PHP
6. Python
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.


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

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.

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.

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

We can also view the created build definition

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.


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

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.

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.

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.

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

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.
This article has been editorially reviewed by Suprotim Agarwal.
C# and .NET have been around for a very long time, but their constant growth means there’s always more to learn.
We at DotNetCurry are very excited to announce The Absolutely Awesome Book on C# and .NET. This is a 500 pages concise technical eBook available in PDF, ePub (iPad), and Mobi (Kindle).
Organized around concepts, this Book aims to provide a concise, yet solid foundation in C# and .NET, covering C# 6.0, C# 7.0 and .NET Core, with chapters on the latest .NET Core 3.0, .NET Standard and C# 8.0 (final release) too. Use these concepts to deepen your existing knowledge of C# and .NET, to have a solid grasp of the latest in C# and .NET OR to crack your next .NET Interview.
Click here to Explore the Table of Contents or Download Sample Chapters!
Was this article worth reading? Share it with fellow developers too. Thanks!
Subodh is a Trainer and consultant on Azure DevOps and Scrum. He has an experience of over 33 years in team management, training, consulting, sales, production, software development and deployment. He is an engineer from Pune University and has done his post-graduation from IIT, Madras. He is a Microsoft Most Valuable Professional (MVP) - Developer Technologies (Azure DevOps), Microsoft Certified Trainer (MCT), Microsoft Certified Azure DevOps Engineer Expert, Professional Scrum Developer and Professional Scrum Master (II). He has conducted more than 300 corporate trainings on Microsoft technologies in India, USA, Malaysia, Australia, New Zealand, Singapore, UAE, Philippines and Sri Lanka. He has also completed over 50 consulting assignments - some of which included entire Azure DevOps implementation for the organizations.
He has authored more than 85 tutorials on Azure DevOps, Scrum, TFS and VS ALM which are published on
www.dotnetcurry.com.Subodh is a regular speaker at Microsoft events including Partner Leadership Conclave.You can connect with him on
LinkedIn .