Introduction
As the name implies, DevOps is the integration of development and operations. It is a new stream of automation that takes software development and its life cycle to the next level, thereby reducing manual and risk/error-prone situations. It adds value to the delivery and serves to enhance the quality of the software. In today's era, if we look around, we see a lot of tools and technologies built to leverage DevOps. One of them is Jenkins. Jenkins is not new, but its seamless and easy methodology of integration into any system has made it more robust and reliable. Gone are the days when integration and deployment were troublesome manual tasks. Having these kinds of tools in place helps a developer, in fact, the whole team, forget about the integration and deployment, as they know that there is an automated process in place to take care of this. This article will cover the topic of continuous integration and deployment using Jenkins in detail. This article will explain the concept of CI/CD, Jenkins, getting started with Jenkins, and integrating and deploying an ASP.NET Core application locally and to the Azure Service as well. While we go through, we’ll also cover topics like creating Azure service, creating Azure service principal, and configuring Jenkins on Azure.
Roadmap
The following is the road map we would be following to completely learn end-to-end development and configurations of Continuous Integration and Deployment (CI/CD) of Asp.Net Core Application on Azure Web App using Jenkins.
- Day 1: Continuous Integration of ASP.NET Core application using Jenkins
- Day 2: Publish the ASP.Net core application to Azure App Service and Configure Jenkins on Azure
- Day 3: Integrate Jenkins with Azure Active Directory and Service Principal
- Day 4: CI/CD of ASP.NET Core application on Azure using Jenkins Azure Pipeline.
DevOps
DevOps is the combination of different people, processes, and operation tools. It helps the development and operations team in providing a common, mutually understandable platform. It segregates and draws the line between where the development team stops and where the operation team starts. The tools and technologies for continuous integration and deployment are part of DevOps which helps fetch the committed code, restore the dependencies, compile the application, run the unit test cases (if any), deploy the application, and make sure it is up and running. There is a lot more that comes under DevOps that is out of the scope of this article, like monitoring the application and its related attributes.
Continuous Integration
The situation where a developer commits the code to a source control (be it SVN, Git or any other source control) and an operation/process/tool continuously monitoring that source control to fetch the fresh copy of the code, restore the dependencies, compile the code, run all the unit tests, integrate the code with the code of other developers, generate the report, notify team members and generate the artifacts and deployable package is known as Continuous Integration in simple terms. There are many more operations that could be part of Continuous Integration, but this is the basic flow to understand it.
Continuous Deployment
Continuous deployment is the next step that a DevOps operation/process/tool looks to. It helps the team continuously deploy the deployable package produced by CI based on certain parameters. These CI and CD steps are repetitive and are subject to how their triggers or callers are configured. The deployment could be done in stages, for example, there could be stages where the code first needs to be deployed on the dev server, then the QA server, then UAT, Stage, and then Prod. Continuous deployment thereby eliminates the manual process of deployment and based on certain triggers, parameters, and conditions, the code automatically is deployed and runs on the configured servers, also in sequential stages.
Jenkins
Jenkins being an open-source tool for automation, helps a team/developer build and test the software code continuously. It makes it easy for a developer to integrate and test the code without manual intervention. The tool could be set up to create a deployment pipeline that includes continuous integration of the code at each code commit, continuously testing the build, publishing artifacts and documents, and deploying the code. Jenkins could be configured on the servers, say it be development, staging, or production as per the deployment needs.
Azure Web App Service
Azure App Services serve as a Platform as a Service (PAAS) in the Azure cloud. Azure Web App Service makes it easy to host an application on a cloud platform with the liberty to build and deploy the application using tools, frameworks, and platforms as per discretion. It takes care of autoscaling, high availability, and load balancing of the applications so that developers do not have to worry about the environment and can focus on development.
Theme
This article series will explain using Jenkins for CI and CD of an ASP.NET Core web application on the local development environment, publishing the web application to Azure Web App Service, and configuring Jenkins on Azure for continuous integration and continuous deployment of the hosted application. GitHub will DevOps as a source control repository. We’ll create a pipeline using Jenkins that fetches the code from GitHub, builds the code, runs the tests, and deploys the package. This will be a repetitive task on each commit to the code located on GitHub.

Prerequisites
The following are the prerequisites for the developers to have on their machines before getting started.
- Visual Studio 2017/2019.
- Dotnet 2.1 SDK installed.
- Azure Subscription Free/Paid.
- Java 1.5 or higher.
- Git account
- Git for Windows
Installing Jenkins
Let’s install and get Jenkins running on the local development environment step by step.
Prerequisites
Jenkins is a Java application and needs Java Runtime to run. So, install Java 1.5 SDK or its higher version on the development machine. Download the latest version here.
Download and Install
Navigate to the URL -https://jenkins.io/ and follow the instructions given below.
- Click on the Download button and it will show the list of options for downloadable. We’ll use the Windows version of Jenkins downloadable. So, click on Windows in the LTS list and the download should begin immediately.

- Once downloaded, unzip the package and run the MSI to install Jenkins, follow the instructions of the wizard, and install Jenkins.

- Jenkins will be installed on localhost:8080 by default. Once the installation is done. Navigate to the URL http://localhost:8080/ and the screen will appear to unlock Jenkins. Use the password stored in the file initialAdminPassword to unlock Jenkins as shown in the following image.

Jenkins Plugins
Before working with Jenkins, there are few plugins that need to be installed. Since Jenkins supports many tools and frameworks, the desired set of tools needs to be plugged into Jenkins to get things working. We’ll install our needed set of plugins. Initially, install all of those that are recommended by clicking on the first option, “Install Suggested Plugins.”

This will take a while while we install all the basic plugins for Jenkins.

Get it Running
Once the basic plugins are installed, it will ask to create an Admin user. You can provide the desired details and make sure you remember the username and password.

Once you provide the details and click on “Save and Continue”, you are done installing Jenkins. To get it running, click on “Start using Jenkins”.

To avoid a login each time you open Jenkins, you can go to the “Configure Global Security” section shown on the Jenkins dashboard. Check the “Allow anonymous read access” option.

Installing Custom Plugins
Since we will be using an Asp.Net application and unit tests, install the related plugins that support this application. Go to the Plugin manager and install MSBuild, MSTest, MSTestRunner, PowerShell, VSTestRunner, and Git plugins if those are not already installed.
























Sourav Kumar DasPosted Dec 5, 2019, 12:55 AM
Nice and useful article Sir.