Azure CI/CD: CI/CD Automation in the Azure Cloud - Spot.io

Azure CI/CD: CI/CD Automation in the Azure Cloud

What is Azure CI/CD?

The Azure cloud has advanced solutions that let you create a Continuous Integration and Continuous Delivery (CI/CD) pipeline in the cloud. Here is a quick definition of CI/CD:

Continuous integration (CI)—the practice of merging feature changes using feature branches into a master or development branch several times per day, and compiling the code on a build server with each merge.
Continuous delivery (CD)—an automated mechanism for deploying software that allows teams to release a new version to production at any given time.
Continuous deployment (CD)—an automated deployment process that you define and the pipeline executes without manual intervention.

Azure offers two primary managed CI/CD tools—Azure DevOps and Azure Pipelines. Azure DevOps lets you manage CI/CD processes by defining entities like artifacts, boards, and test plans. Azure Pipelines provides version control, a build server, and deployment systems that can put CI/CD into practice.

In this article:

What are Azure DevOps and Azure Pipelines?

Both Azure DevOps and Azure Pipelines are designed to facilitate efficient CI/CD pipelines. Here are key features offered by each service:

Azure DevOps
Azure DevOps offers several development services that help teams plan, build, collaborate, deploy, and support their applications. Azure DevOps offers integrated features in an integrated development environment (IDE) or a browser.

Here are notable Azure DevOps services:

  • Azure Pipelines
  • Azure Repos
  • Azure Boards
  • Azure Artifacts
  • Azure Test Plans

Azure Pipelines
This service aims to simplify CI/CD pipelines designed for application development. It lets you start from a source stage containing existing code hosted on GitHub or on-premise containers.

Here are key advantages of Azure Pipelines:

  • Version control systems—the first step in building an Azure CI/CD pipeline is to put your code in a version control system. The service lets you manage your source code in any repository, including GitHub, Subversion, or Bitbucket. Additionally, Azure Pipelines supports team foundation version control (TFVC).
  • Programming languages and application types—Azure Pipelines lets you use various languages, including Java, C, Ruby, C++, PHP, Python, JavaScript, and Go.
  • Deployment targets—Azure CI/CD pipelines enable you to deploy applications to multiple target environments.

Learn more in our guide to Azure DevOps Pipelines (coming soon)

Azure CI/CD Architecture Examples

Here are three references architectures provided by Microsoft, which illustrate how to set up CI/CD processes in the Azure cloud.

CI/CD for Azure VMs

Here is how Azure can help you set up a CI/CD pipeline to push changes to Azure VMs. Azure DevOps provides a Git repository, a build system, and a complete release management that automates deployment to production, development, and testing environments.

The entire process leverages Azure Resources Management (ARM) templates, Azure’s infrastructure as code (IaC) platform. You define ARM templates to provision infrastructure in each of your environments and deploy the new build on it.


Image Source: Azure

The workflow is as follows:

  1. A developer changes the source code.
  2. The developer commits the code and a new version of the ARM template, if applicable.
  3. The CI server triggers build and unit tests.
  4. A CD trigger orchestrates the deployment of application artifacts.
  5. Artifacts are deployed to a testing environment.
  6. Following automated tests, artifacts are deployed to a staging environment.
  7. Following additional tests, artifacts are deployed to a production environment.
  8. Azure Application Insights analyzes the health and performance of the new version.
  9. The release manager analyzes the data.
  10. The release manager updates the backlog item to indicate the relevant feature is released.

CI/CD for Containers

If you are using Azure Kubernetes Service (AKS) to manage a containerized application using Kubernetes, Azure DevOps can help you set up continuous build and deployment for your containers.


Image Source: Azure

The workflow is as follows:

  1. A developer changes the application source code.
  2. The developer commits code changes.
  3. The CI server triggers a build, creates a new version of the container image, and performs unit tests.
  4. The new version of the container image is pushed to Azure Container Registry (ACR).
  5. A CD trigger orchestrates the deployment of the new image and other application artifacts with parameters specific to the environment (dev/test/production)
  6. The new image is deployed into Azure Kubernetes Service (AKS).
  7. A container is launched using the updated image.
  8. Azure Application Insights analyzes health and performance.
  9. The release manager analyzes the data.
  10. The release manager updates the backlog item to indicate the relevant feature is released.

DevOps in a Hybrid Environment

Azure supports a hybrid development environment where development occurs on-premises alongside the Azure environment. Azure DevOps lets you manage one CI/CD process that deploys artifacts to an on-premise data center and Azure in parallel.


Image Source: Azure

The workflow is as follows:

  1. The code repository can be GitHub Enterprise or a similar solution that integrates with Azure.
  2. A developer performs a pull request, triggering a build and automated tests managed by Azure Pipelines.
  3. Azure Monitor provides data on the new version, which can be used to device whether to release the new version or rollback.
  4. The new release triggers Terraform, enabling deployment on both on-premises and cloud environments using infrastructure as code. Terraform can provision VMs in the on-premise environment and Azure VMs or other resources in the Azure environment.
  5. Azure Pipelines defines a CD process for Azure and a separate CD process for the on-premises environment.
  6. Azure Key Vault helps securely inject your secrets into both types of deployments.
  7. Azure Monitor stores analytics and enables continuous monitoring of both the on-premises and the Azure environment.
  8. Azure AD can be used for consistent identity management for both on-premises and Azure pipelines.

Tutorial: Create Your First Java Pipeline in Azure

Prerequisites

  • A GitHub account—enables you to create a repository. You can use an existing account or create a new one for free.
  • An Azure DevOps organization—You can use an existing account or create a new one for free.
  • Administrator privileges—needed to allow you to use your Azure DevOps project.
  • The ability to run pipelines on Microsoft-hosted agents—Azure lets you purchase a parallel job or request a free tier.

Create Your First Pipeline

  1. Fork this repository into your GitHub account.
  2. Sign-in to your Azure DevOps organization.
  3. Choose an Azure DevOps project and then go to the Pipelines page.
  4. On the Pipelines page, choose the Create Pipeline button.


    Image Source: Azure

  5. Go through the wizard’s steps directing you in creating your first pipeline. In this example, you first need to select GitHub as the location of the source code.

    Image Source: Azure
  6. The wizard might redirect you to sign in to GitHub. If this happens, enter your GitHub credentials.
  7. Once a list of repositories is displayed, choose a sample app repository.
  8. Azure Pipelines now analyzes your repository and recommends a suitable Maven pipeline template. Choose Save and run, then Commit directly to the main branch, and then Save and run again.
  9. The system starts a new run—you should wait for the run to finish.

Azure CI/CD with Spot by NetApp