Introduction
In the first article of the series, we learned about concepts, terminology, technologies involved, installing Jenkins, and creating ASP.NET Core application. We also covered the continuous integration of an ASP.NET Core application using Jenkins via two approaches, the pipeline approach, and the freestyle project approach. In the second article, we published the ASP.Net core application to Azure App Service and Configured Jenkins on Azure. In the third article of the series, we focused on Azure Active Directory and Service Principal and how to integrate Jenkins with Azure Service Principal.
Roadmap
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 deploy the package. This will be a repetitive task on each commit to the code located on GitHub.
Following is the roadmap 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.
Jenkins
Jenkins is an open-source tool for automation that helps a team/developer build and test the software code continuously. It makes 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.

Prerequisites
Go through the first two articles of the series before starting this article.
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
CI/CD of ASP.NET Core application on Azure using Jenkins Azure Pipeline
This section will explain how we can enable continuous integration and deployment of our application. All the required setup has been done. We just need to configure Jenkins now to make it happen. We’ll do this by using a pipeline project approach.

Create new Pipeline Job
On the Jenkins home page, create a new job.

Give a meaningful name (e.g. Jenkins-on-Azure) to the pipeline project and select “Pipeline” as the project type.

Add Parameters
On the General tab, check the option saying, “This project is parameterized”. We’ll add a few parameters here.

Add three string parameters named git_repo to provide URL of the git repository, res_group to provide the name of the resource group and JenkinsIntegration, this would be the name of our web application project. You can provide the default values here, or else you would be asked to provide those while running the build.

Add a credentials parameter named azure_cred_id and choose credential type as “Microsoft Azure Service Principal”, the default value will be the ID service principal we created earlier.

Add Pipeline Script
In the Pipeline script section, provide the pipeline script for git check out, build, publish and deploy.














Join the conversation! Your thoughts help the community grow.