Azure DevOps CI-CD Pipeline Tutorial – CI Part

We will create a simple demo CI-CD project using different products of Azure DevOps such as Azure Repos and Azure Pipeline. learn more about CI-CD here.

Signup on Azure DevOps

Signup for the Azure DevOps at

You will get this page which has the different options to getting started with Azure DevOps. After Signup, login into Azure DevOps.


azure devops signup


Creating and Setting Up a New Project:


Step 1. Create a new project:

Click on the “New Project” button.

Project name: Provide a suitable name for the project.

Description: Provide a suitable description for the project.

Visibility: This will ensure the privacy of the project such as visibility of code present in Azure Repos. Choose between Public or Private.

Note: Public option doesn’t support TFVC.


    ✔ Version control: Select between Git and TFVC.

    ✔ Work item process: It will help in Azure Boards as you can choose among Agile, Scrum, Basic, and CMMI where Basic is like an empty temple.

✔ Click on Create to create the project.


create a project


Step 2. Setting up Azure Repos

Click on Azure Repos. It will provide different options to get the code of the project.

Options such as:

  1. Clone the repo to your computer, and then adding code in the cloned folder and push it here.
  2. Pushing an existing repository from the command line by adding the remote origin.
  3. Importing a repository from another Git or TFVC based VCS.

We will use the 3rd option in this case.

✔ Click on the Import button under the “Import a repository” option.

Repository type: Choose Git or TFVC.

Clone URL: Paste the URL of the project. Here’s the sample code URL.


import code


✔ Click Import and it will import the code in Azure Repos.


code pull


✔ Now, the code is imported successfully in Azure Repos.


code imported


Step 3. Setting up the Build Pipeline

Go to the pipeline and click on create a pipeline.

3.1 Select Pipeline Editor, you have two options to create Azure Pipeline, using YAML and using the Classic editor (GUI-based pipeline editor).


use classic editor


3.2 Select your repository, you can get the code from different VCS for the pipeline. As we have already cloned the code in Azure Repos,

    ✔ Select a Source: We will select the Azure Repos.

    ✔ Team project: the right project is already selected but you can choose another as well.

    ✔ Repository: Select the repository.

    ✔  Default branch for manual and scheduled builds: Select the right branch.

    ✔ Continue to the next step.


select repository


Note: You need to generate credentials to push the code in Azure Repos.

3.3 Choose a template

Here, you can choose different templates as per the project requirement.

    ✔ Empty Job: This will give you no template and the option to select different tasks as you need.

    ✔ Configuration as code: you can write the pipeline in the YAML language as you needed.

    ✔ Featured: This has some examples of templates.

    ✔ Search: You can always search for the template you want.

    ✔ Search for Maven and “Apply” that.


choose template


    ✔ The template will provide pre-configured tasks as shown below.


maven template


Step 4. Understanding the Build Pipeline Components

There are lots of things that came on the screen so, we will try to understand what are they. This will help us to move forward in the demo.


    ✔ Name: It’s the name of the Build Pipeline. The name has the CI at the last because here we will set up Continuous Integration of the pipeline.

    ✔ Agent Pool: It is a group of different agents provided and managed by Microsoft.

    ✔ Agent Specification: Here we can choose Agents with different OS.

    ✔ Parameters: It’s just selecting the pom.xml file as we have chosen the Maven template earlier.


Get Sources: This has all the source code configuration that was configured in Step 3.2 and we can change the configuration here if required.


Agent Job 1:

    ✔ Display Name: Name of the Agent.

    ✔ Agent selection:

        ✔ Agent pool: Select different agent pools in this step as well but the default is <inherit from pipeline> that means the configuration is the same as mentioned above field.

        ✔ Demand: Specify which capabilities the agent must have to run the pipeline.

    ✔ Others are the advanced options that can be used for the much-advanced demo.

✔ Below are 3 tasks added by the template.

✔ You can add other tasks by clicking the plus (+) icon on Agent Job 1 step.


Step 5. Understanding and Modifying the Tasks

Maven pom.xml: This task will let us make a build using Maven.

    ✔ Display name: Name of the task.

    ✔ Maven pom file: the path of the pom file.

    ✔ Goals: Here we can mention the goals/phase of Maven. We are using the package here. Learn more about the Maven phase/goals here.

    ✔ JUnit Test Results: It is performing a Junit test on the code.

    ✔ There are other options as well like performing a code coverage and other advanced option which is not needed in our demo project. So, we will leave it all as default.


maven task


Copy Files to: This task will get the artifact after the build. Which is a .war file. From this task, you can see some predefined variables Azure DevOps uses.

    ✔ Display name: Name of the task.

    ✔ Source Folder: The path where the artifact will be present. Leave as default.

    ✔ Contents: We will provide a pattern to find the artifact. In our spring project, the artifact will a .war file. So, update the value with **/*.war

    ✔ Target Folder: It is a path predefined by Azure DevOps to store artifacts in Agent.


copy task


Publish Artifact:

    ✔ Display name: Name of the task.

    ✔ Path to publish: This is the path of the artifact saved in the above task. The value is the same in Target Folder in the above task.

    ✔ Artifact name: Name of the artifact.

    ✔ Artifact publish location: It’s the location where the artifact is going to be stored so that we can get this artifact in the Release Pipeline for the CD part of the project.


publish artifact


Step 6. Save and Run the Build Pipeline.

✔ Click on the Save & queue dropdown. Click on Save first and then click on the Queue button (Recommended) or you can click directly on Save & queues dropdown.

✔ The next page will show some configurations, check them and click on Run button.

✔ On the next page, click on Agent Job 1 to see the console logs of each task.

✔ Here, you can see the logs of all the task.


ci-cd logs


 Step 7. Enable Continuous Integration on Build Pipeline

Go to the Build pipeline configuration page after the successful build to enable Continuous Integration.

✔ Click on the Triggers tab.

✔ Check the Enable continuous integration box.

✔ Save the configuration.


enable CI


You can test the Continuous Integration working by committing some changes in the code and pushing that into the Azure Repos.



Here we have learned, how to create an Azure DevOps project, import source code in Azure Repos, and creating a build pipeline in Azure Pipelines. We have configured all these steps in a systematic way. This is only the Continuous Integration (CI) part of the project.

The Continuous Delivery (CD) part is in the next module.