DevOps Project in Azure – Automating CI/CD Pipeline on VSTS
Posted by: Subodh Sohoni
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
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.
Datadog, a monitoring and analytics platform that integrates with more than 250 technologies, unites metrics, traces, and logs in one platform so you can get full visibility into your infrastructure and applications. With powerful dashboards, anomaly and outlier detection, and distributed tracing, Datadog helps you get a handle on the performance of your .NET applications, as well as their underlying infrastructure.
Click here to try Datadog’s full-stack monitoring for free! (No Credit Card required)
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.
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 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 eBook 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 .NET Standard and the upcoming C# 8.0 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!