How Does CI/CD Work in Azure?
Azure is a cloud platform that hosts virtual machines running Linux or Windows and provides a range of computing and data services. Modern DevOps organizations organize software development in an automated Continuous Integration / Continuous Delivery (CI/CD) pipeline. In the Azure cloud, you can use a CI/CD process to automatically push software changes to Azure-hosted virtual machines.
Azure DevOps offers a CI/CD pipeline to support development projects. It includes a Git repository to manage the infrastructure and application source code in the form of Azure Resource Management (ARM) templates (Azure’s native infrastructure as code system), a build system that produces artifacts like binaries and software packages, and a software release management tool to help you set up the pipeline and deploy changes via development, testing, and production environments.
The Azure DevOps pipeline provisions and updates infrastructure based on ARM templates and automatically deploys updated builds. You can save costs by leveraging Azure DevTest Labs, which automatically terminates unused testing resources.
Related content: Read our guide to the CI/CD pipeline
Azure DevOps Services and Tools
Azure Boards
Azure Boards offers interactive and customizable tools for managing software development projects. It includes native support for Scrum, Kanban, and Agile processes, configurable dashboards, integrated reporting, and calendar views. Azure Board’s tools are scalable, allowing you to adapt to changing business needs.
Azure Repos
Azure Repos provides version control tools for managing code. Version control systems are designed to help development teams track changes made to the codebase over time. As various collaborators edit the code, the version control system takes snapshots and saves them permanently. It saves your work and coordinates code changes across teams.
Azure Pipelines
Azure Pipelines is a cloud-based service that automatically builds and tests your code projects. The service uses CI/CD to test and build code and then ships it to the target of your choice. It supports any project type and programming language and can build on Windows, Mac, or Linux machines. You can integrate Pipelines with Azure deployments and GitHub and deploy code to multiple target types. It also works with various open source projects.
Azure Test Plans
Azure Test Plans is a browser-based testing management solution. It provides easy-to-use tools to help drive quality and collaboration across the development lifecycle and various testing capabilities. It lets you run tests and gather feedback from stakeholders. Notable testing types include exploratory testing, planned manual testing, and user acceptance testing.
Azure Artifacts
Azure Artifacts enables you to efficiently share code and manage all packages from a central location. You can use this service to publish packages to feeds and share them with the same team, across the organization, or publicly. It also lets you consume packages from various feeds and public registries like npmjs.com and NuGet.org. It supports many popular package types, including npm, NuGet, Python, Universal Packages, and Maven.
Related content: Read our guide to CI/CD tools
Designing a CI/CD Pipeline Using Azure DevOps
You can use services like Azure DevOps and Azure App Service to simplify and automate the management of your supporting infrastructure. The example below shows a CI/CD pipeline that deploys a .NET web application with two tiers to Azure App Service.
Image Source: Azure
The pipeline processes data in the following way:
- A developer makes a change to the application source code.
- The developer commits the application code, including the config file, to a repository in Azure Repose that contains the source code.
- The continuous integration pipeline triggers the application build and conducts unit tests via Azure Test Plans.
- The continuous deployment component in Azure Pipelines triggers the automated deployment of the specified application artifacts with configuration values specific to the environment.
- The pipeline deploys the artifacts to App Service.
- Azure Application Insights collects usage, performance, and health data and conducts an analysis.
- The development team monitors and manages the usage, performance, and health information provided by Application Insights.
- The team uses backlog information to prioritize new bug fixes and features on Azure Boards.
Azure CI/CD Pipeline Best Practices
The following best practices will help you make the best use of Azure CI/CD tooling.
Learn about additional best practices applicable to all environments in our guide to CI/CD best practices
Build All Environments At Once
In Azure DevOps, there is no need to create a new build for each environment every time you need it. You can build all environments at once with a few different packages set up as separate artifacts in the same pipeline (for example, one for development, one for staging, and one for production).
This has several advantages. It speeds up compilation time, lets you deploy much faster, and ensures that the same artifacts deployed to a testing environment are also deployed to user acceptable and production.
Make Use Of Release Pipelines
You can and should separate releases from builds. Initially, you can use the release pipeline to create packages and manually send them to others for deployment. This is a good first step. The next step is to copy the files automatically to a temporary folder on the server. Every step like this takes you closer to a fully automated deployment.
Automate Package Configuration on Release Pipelines
It is important not to update configuration files during the build process, and only do it in the release pipeline. The main reason is security—configuration files can contain secrets that should not be exposed to unauthorized parties.
Instead of adding this sensitive data to build pipeline artifacts, you can leverage the secure files feature provided by Azure DevOps. This feature retrieves secure files, uses them for a release, and once it is deployed, destroys the sensitive data.
This process is fully automated, meaning nobody needs to manually update configuration files after deployment is complete, and less prone to human error which can create security risks.
CI/CD in the Cloud with Codefresh
Codefresh has made it our mission since 2014 to help teams accelerate their pace of innovation. The Codefresh platform, powered by Argo, combines the best of the open-source with an enterprise-grade runtime allowing you to fully tap the power of Argo Workflows, Events, CD, and Rollouts. It provides teams with a unified GitOps experience to build, test, deploy, and scale their applications.
The World’s Most Modern CI/CD Platform
A next generation CI/CD platform designed for cloud-native applications, offering dynamic builds, progressive delivery, and much more.
Check It Out