Azure Pipeline Basics

Amr Younis
5 min readOct 31, 2020

--

In this article, I’m going to give you the basics to understand what’s Azure Pipeline and how it’s work

Table of contents

  • for who this article?
  • What is Azure Pipelines?
  • What are the benefits of Azure Pipeline?
  • What are the CI and CD?
  • What is the difference between YAML syntax and Classic Interface?
  • Key concepts of Azure Pipelines

for who this article?
this article is for beginners on Azure DevOps and it contains only the basics that can be used to start learning and working with Azure Pipelines

What is Azure Pipeline?
Azure Pipelines is a cloud service that can be used to automatically build and test your code, publish code coverage, and publishing the artifacts of your projects and the most powerful points are that the Azure Pipeline is working with any language and tools and can be used to deploy your code to multiple targets (container registry, virtual machine, azure app service or any on-premises VMs) or publish package formats (NuGet, npm, Marven).

What are the benefits of Azure Pipeline?

  • Implementing CI and CD which helps to ensure the consistent and code quality
  • Azure Pipeline works with any languages or platform
  • Azure Pipeline support deploying in different types of targets at the same time
  • Azure Pipeline support build on different OS (Windows, Mac, Linux)
  • Working with open source projects

What are the CI and CD?

  • Continuous Integration (CI)
    Continuous Integration is a development practice where the developers integrate code into a shared repository frequently, preferably service times and each integration can then be verified by an automated build and automated ran unit tests and publish code coverage so it’s helping to increase code coverage and Ensuring that you didn’t ship a broken code.
Continuous Integration (CI)
  • Continuous Deployment (CD)
    Continuous Deployment is the second step after the CI step is succeeded which boils down to deploy your code to any target stage (development, testing, production) which use the latest test code form the CI process and with azure DevOps release you can set multiple pre-condition before deployments like gates and approvals or make it works with target branches or schedule.
Continuous Deployment (CD)

What is the difference between YAML syntax and Classic Interface?
basically, there are two ways to write a YAML file and both have pros and cons and the most powerful one is YAML syntax.

  • YAML syntax
    To create a Pipeline using YAML syntax you define a file called azure-pipelines.yml on your code repo YAML is the newer way where you can define the pipeline as code, in YAML format, which you then commit to a repo. Azure DevOps does have an assistant to help you create/modify the YAML pipelines, so you don’t have to remember every possible setting or keep having to look up references.

To create azure-pipelines.yml file follow that steps

  1. Go to your Azure DevOps account
  2. Create a New project set the project name, description, and visibility
  3. From the created project click on the build icon
  4. From the build, tab click on Pipeline the click create Pipeline
Pipeline

5. Choose the place of your code let’s say it Azure Repo Git for now

6. Choose your repo then choose your build configuration type if you did not find you type click on show more

7. Now you have the YAML file created add you tasks from assistant then click save and run

  • Classic Interface
    Create and configure pipelines in the Azure DevOps web portal with the Classic user interface editor. You define a build pipeline to build and test your code, and then to publish artifacts. You also define a release pipeline to consume and deploy those artifacts to deployment targets.

To Create build Pipeline using Classic interface flow the four previous steps then

5. form this page click use the classic editor

6. Select your source and trigger branch then press continue

7. Select the build template lets says ASP.Net core

8. No edit necessary data then click save & queue

Please note that the YAML syntax way is the most powerful way because it supports more features like approvals, container jobs, deployment group, environment gates which not supported by Classic interface plus the ability of edit you Pipeline outside of the azure DevOps web browser since you have the file on you code repo.

Key concepts of Azure Pipelines

A Trigger is something that’s set up to tell the pipeline when to run. You can configure a pipeline to run upon a push to a repository, at scheduled times, there are two main types of triggers Build Trigger and Release Trigger.

The agent used to build or deploy your code and you need at least one agent and there are two types of agent Microsoft-hosted agents and Self-hosted agents.

Approvals define a set of validations required before a deployment can be performed. Manual approval is a common check performed to control deployments to production environments.

A Step is the smallest building block of a pipeline A step can either be a script or a task.

A Script runs code as a step in your pipeline using the command line, PowerShell, or Bash

A Task is the building block for defining automation in a pipeline. A task is a packaged script with a set of inputs.

An Artifact is a collection of files or packages published by a run. Artifacts are made available to subsequent tasks

Please note that the azure-pipelines.yml can contain more the one stage and each stage have multiple steps.

--

--

Amr Younis
Amr Younis

Written by Amr Younis

0 Followers

Software Engineer

No responses yet