Azure Pipelines

Those days are gone where developers take years to develop and release new software products, nowadays people are expecting to see their favourite apps with the latest features and work faster than ever. So, every software development company requires an effective DevOps pipeline to reach the customers demands and needs. This course will guide you through what is azure pipelines, prerequisites for the azure pipelines, its documentation and why should we use azure pipelines and how to build the azure pipeline from scratch. It can be used for all types of projects and programming languages, and the concepts are the same and shared among them.

Any software needs to be deployed, written and tested into production environments, developers and DevOps build and release pipelines which automates much of this activity, pipelines allow DevOps teams and others to produce and deploy reliable code. The way of building a pipeline is with Azure DevOps along with a feature named as Azure pipeline. If you never heard about pipelines or azure DeVops this tutorial is for you.

What Is Azure Pipelines?

It is a cloud service which we can use to build and test our code project automatically and make it available for other users too. It works with any kind of project and with any language, it is used to combine continuous integration and delivery to constantly and consistently build and test our code and deliver it to any target. Before we use  continuous integration and delivery practice for our applications, we need our source code in the version control system. We can use various languages with azure pipelines, like JAVA, JAVAscript, Python, PHP, RUBY, C++, etc. and it integrates with Bitbucket cloud, GITHub, GITHUB enterprise, azure reports Git and TFVC. 

Azure pipelines are used to deploy our code to various targets, and those targets include container registries, azure services, virtual premises or any cloud target or on premises. To produce packages which may be consumed by others, we can publish npm or maven packages to the built-in packages management respiratory in it. We may also use any other package management repository of our choices. Azure pipeline is free of cost when we use it for public projects, but when we use private projects, we can run up to 1800 minutes of azure pipeline jobs for free every month.

Prerequisites for azure pipelines:

  • We need the following prerequisites to use Azure pipelines.
  • We need an organization in Azure DevOps.
  • We need to maintain our source code stored in a version control system.
  • We need to have An Azure account.
  • JWe have to log into the Azure Portal with the global administrator or similar rights.
  • We require A GitHub account.
  • An empty Github repository created is also required.
  • And an empty Azure WebApp deployed using dotnet core 2.2 and Linux for the platform

Why should we use azure pipelines?

Azure pipeline helps to ensure consistent and quality code by implementing CD and CI, which are readily available for users. They offer a quick, easy and safe way to automate building making our projects available for users. We should use Azure pipelines because it provides the following scenarios.

  • Azure pipeline works with any platform or with any language.
  • Azure pipelines deploy to various kinds of targets at the same time.
  • It helps to integrate with Azure deployments.
  • Azure pipelines built on Linux, Max machines and Windows.
  • It works with open-source projects.
  • And helps to integrate with GitHub.

Azure Devops Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

Building an azure DevOps build Pipeline

We have an azure DevOps projects and organization setup, now we may create a build pipeline inside. Pipeline plays a crucial role where we can create builds to perform different tasks such as bringing in dependencies, compiling code, etc. 

1. Select the pipelines then on builds from the dashboard.

2. Then we will see a message telling us that there are no built pipelines found yet. And Click on New pipeline to begin creating the build pipeline.

3. We are then prompted for where our code is stored, the code is stored in a GitHub repository. Then select GitHub. Which is the place where code is stored and the triggers to invoke the build will come from.

4. When we click on GitHub, then we will be prompted to provide our GitHub account credentials as shown below. 

5. Finally, confirm the step where we are asked to authorize Azure Pipelines. Which ensures Azure DevOps has permission to provide access to our GitHub repos.


Linking a GitHub Repo to the Build Pipeline:

when we have provided Azure DevOps permission to our Github account account, then we need to link a GitHub repo to that build pipeline. 

1. First we need to select the empty GitHub repo that we have created for this Project.

2. And then have to allow the project to read, write and check source code from the repository, which we selected earlier, and confirm the process by clicking Approve & Install.


Ops Trainerz

Subscribe to our youtube channel to get new updates..!

3. We will see an error generated as given below, this error will happen because the GitHub Repo selected is empty, by clicking on the conform. At the point where our GitHub repo will be linked to our Azure DevOps build pipeline.


Populating Sample GitHub Repository Code:

That build pipeline runs with the help of some code in the GitHub repo, Which doesn’t necessarily Important at this point. To get that code in the repo, we can use an existing repo to clone some code from repo, which we have all the source code available to publish the sample application of e commerce in Azure WebApps, that sample code for this repo will have a sample e-commerce application named as SimplCommerce. And that application is an open-source dot net core application which is more realistic than the typical “hello world” project.

1. To navigate this sample GitHub repo and then click on Import code as given below.


2.  For the old repository’s clone, use the URL and then click on Begin import. If the repo import step is completed successfully, then it refreshes the Azure DevOps Pipeline window, which should allow us to continue now.


Inspecting and Viewing the Build Pipeline in YAML:

In this stage, we will be at the Review phase of the pipeline creation process. Now we will be provided with a representation of the build pipeline in YAML, which file is automatically built that is based on the detection of the source code language, that is dotnetcore in this Project.


Manually Running the Azure Build Pipeline:

This is a continuous integration (CI) pipeline, and the build is typically triggered through a commit to source control. We can also manually trigger the build pipeline to run, and allow kick off a build pipeline manually to see what happens. When we have been following along, at point, we should be to the point where we can click on Run to kick off the build pipeline, which starts the pipeline build process as we can see from the given screenshot.


Then a few seconds later, we may see that the process will run for macOS as given below, and the build pipeline will return information in real-time as each job and task in the pipeline runs.


After that the build pipeline may repeat the similar process for the remaining operating systems as given below, and the steps taken will vary more depending on how the YAML file was built.


Azure Devops Training

Weekday / Weekend Batches

When the build has completed, we are greeted with green checkmarks as given below, and the screenshot indicates each platform build passed successfully.


Finally, we have now created an Azure DevOps build pipeline.

Building an Azure DevOps Release Pipeline:

Pipeline is created which is a great progress, when we were to stop at this point, then we have been well on our way for a complete automated pipeline. The ultimate goal of software needs to be deployed so the users can use it and it's time to automate a release too with a release pipeline. The release pipeline takes a build artifact, a result of the build process and deploys that to one or more environments. In this Project, you’re going to use a release pipeline to publish code in the GitHub repo to an Azure Web App, and then from Azure DevOps, 

  • Click Pipelines and then Releases.
  • Later, we need to select New and then New Release Pipeline, which launches the New release pipeline wizard.
  • Then from the template list on the right and select Azure App Service Deployment, and we will see many various types of templates available to save time creating future release pipelines.
  • And gave a description for the Stage Name, and that stage will contain release tasks.  This project uses the name Deploy to webapp.
  • Then The pipeline is created.
  • The Part of the Azure App Service deployment template turns with a few parameters, and we will  need to define it.
  • After completion, click Pipeline in the top menu of our Azure Pipeline project, which will return us to the main screen and provide us a chance to complete the next step that is specifying the artifacts.

Adding Artifacts to the Azure DevOps Release Pipeline:

During the process of  a release pipeline, there are many various  items which need to be deployed, and the items are named as artifacts. They  put simply, and are deployable components of our application, and the Pipelines may deploy artifacts, which are produced by a wide range of artifact sources.
In this section, we cover how to add artifacts to the release pipeline.

  • On the Pipeline screen, you need to click on Add an Artifact.
  • Then click on  the build pipeline designed earlier in the Source dropdown, after completion, click on Add to save the configuration.
  • For the final result, click on the Save button in the upper right corner of the screen, used to save the release pipeline.

Conclusion :
This is a cloud service, which we may automatically use to build and test our code project, the azure pipeline has a lot of features like continuous integration, continuous delivery for designing and delivering our code to any target. They maintain a version control system used to integrate with GitHub enterprise, Bitbucket cloud and subversion. We can use it for deploying our code to various targets, which includes virtual machines, container registries, and azure services, its workflow defines how build and deployment steps run. It is like a stage which contains one or more jobs, each can run on an agent and represents an execution boundary of a set with steps. This represents a single execution of a pipeline and collects the logs that are associated with steps and the results of those running steps, it looks like a best solution for software developers to reach their customers needs and requirements. 

AWS Lambda Developer
I am working as AWS Lambda Developer since 2014. and I have good knowledge skills on AWS & DevOps Platform. TO share my Knowledge through Blogs from OpsTrainerz is Good Opportunity to Me.

Request for more information