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?
- Azure CI/CD Architecture Examples
- Tutorial: Create Your First Java Pipeline in Azure
- Azure CI/CD with Spot by NetApp
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 pipeline.
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:
- A developer changes the source code.
- The developer commits the code and a new version of the ARM template, if applicable.
- The CI server triggers build and unit tests.
- A CD trigger orchestrates the deployment of application artifacts.
- Artifacts are deployed to a testing environment.
- Following automated tests, artifacts are deployed to a staging environment.
- Following additional tests, artifacts are deployed to a production environment.
- Azure Application Insights analyzes the health and performance of the new version.
- The release manager analyzes the data.
- 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.
Learn more in our detailed guide to kubernetes ci cd.
Image Source: Azure
The workflow is as follows:
- A developer changes the application source code.
- The developer commits code changes.
- The CI server triggers a build, creates a new version of the container image, and performs unit tests.
- The new version of the container image is pushed to Azure Container Registry (ACR).
- A CD trigger orchestrates the deployment of the new image and other application artifacts with parameters specific to the environment (dev/test/production)
- The new image is deployed into Azure Kubernetes Service (AKS).
- A container is launched using the updated image.
- Azure Application Insights analyzes health and performance.
- The release manager analyzes the data.
- 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:
- The code repository can be GitHub Enterprise or a similar solution that integrates with Azure.
- A developer performs a pull request, triggering a build and automated tests managed by Azure Pipelines.
- Azure Monitor provides data on the new version, which can be used to device whether to release the new version or rollback.
- 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.
- Azure Pipelines defines a CD process for Azure and a separate CD process for the on-premises environment.
- Azure Key Vault helps securely inject your secrets into both types of deployments.
- Azure Monitor stores analytics and enables continuous monitoring of both the on-premises and the Azure environment.
- 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
- Fork this repository into your GitHub account.
- Sign-in to your Azure DevOps organization.
- Choose an Azure DevOps project and then go to the Pipelines page.
- On the Pipelines page, choose the Create Pipeline button.
Image Source: Azure - 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
- The wizard might redirect you to sign in to GitHub. If this happens, enter your GitHub credentials.
- Once a list of repositories is displayed, choose a sample app repository.
- 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.
- The system starts a new run—you should wait for the run to finish.