Reader small image

You're reading from  Azure Architecture Explained

Product typeBook
Published inSep 2023
PublisherPackt
ISBN-139781837634811
Edition1st Edition
Right arrow
Authors (2):
David Rendón
David Rendón
author image
David Rendón

David Rendón, Microsoft MVP and Microsoft Certified Trainer, is a highly regarded expert in the Azure cloud platform. With over 15 years of experience as an IT professional, he has been deeply committed to Microsoft technologies, especially Azure, since 2010. With a proven track record of leading and driving strategic success, David has over seven years of management experience, technical leadership, and collaboration skills. David delivers private technical training classes worldwide, covering EMEA, South America, and the US, and he is a frequent speaker at renowned IT events such as Microsoft Ignite, Global Azure, and local user group gatherings in the US, Europe, and Latin America.
Read more about David Rendón

Brett Hargreaves
Brett Hargreaves
author image
Brett Hargreaves

Brett Hargreaves is a principal Azure consultant for Iridium Consulting, who has worked with some of the world's biggest companies, helping them design and build cutting-edge solutions. With a career spanning infrastructure, development, consulting, and architecture, he's been involved in projects covering the entire solution stack using Microsoft technologies. He loves passing on his knowledge to others through books, blogging, and his online training courses.
Read more about Brett Hargreaves

View More author details
Right arrow

Using Azure Pipelines to Build Your Infrastructure in Azure

As software development practices continue to evolve, so do the tools and technologies used to streamline the process. One such tool is Azure DevOps, a powerful suite of services for managing and delivering applications. In this chapter, we’ll delve into some of the key features of Azure DevOps, focusing specifically on Azure Pipelines. We’ll cover the configuration of Azure DevOps and Azure Repos, as well as the creation of both build and release pipelines. By the end of this chapter, you’ll have a solid understanding of how to leverage Azure DevOps to enhance your software development workflow.

In this chapter, we’ll cover the following main topics:

  • Understanding the relationship between continuous integration, continuous delivery, and pipelines
  • Understanding Azure Pipelines
  • Configuring Azure DevOps
  • Configuring Azure Repos
  • Configuring a build pipeline in Azure DevOps...

Understanding the relationship between continuous integration, continuous delivery, and pipelines

As organizations adopt a cloud strategy, they realize the benefits of automating the build, test steps, and deployment steps. By automating the entire software delivery process, organizations can deliver software faster and with more confidence while reducing the risk of errors.

Continuous Integration (CI) and Continuous Delivery (CD) are practices that have evolved from Agile software development and DevOps culture that involve automatically building and testing code changes as soon as they are pushed to a source control repository, such as Git.

This helps catch and fix issues early in the development process, reducing the risk of more significant problems later on. They emerged in response to the need for faster and more reliable software delivery in a rapidly changing software development landscape.

As Agile and DevOps practices gained popularity, CI and CD became widely adopted...

Understanding Azure Pipelines

Azure Pipelines is one of the components of Azure DevOps, a CI/CD platform offered by Microsoft. It helps organizations automate the process of building, testing, and deploying software.

Here’s how it works in simple terms:

  1. Code is pushed to a source control repository, such as Git.
  2. Azure Pipelines is triggered by this code change and performs a series of steps as defined in the pipeline.
  3. Build: The code is compiled and turned into artifacts, such as executables or Docker images.
  4. Test: Automated tests are run on the artifacts to verify that the application works as expected.
  5. Deploy: If the tests pass, the artifacts are deployed to the desired environment, such as a production server or a staging environment, for further testing

Azure Pipelines helps automate the entire software delivery process, from building and testing code changes to deploying to production. This helps reduce manual errors, speed up delivery...

Configuring Azure DevOps

Let’s explore how to set up Azure DevOps for your organization, including configuring Azure Repos and creating build and release pipelines. By the end of this section, you’ll have a solid understanding of how to use Azure Pipelines to streamline your software delivery process and improve your overall software development workflow. Follow these steps:

  1. The first step is to go to https://dev.azure.com and create a new project. Note you will need an organization as well. And we will provide the name of the project called, SpringToysApp, and set the visibility to Public, as shown here:
Figure 12.1 – Create a project in Azure DevOps

Figure 12.1 – Create a project in Azure DevOps

Now, let’s configure the access from Azure DevOps to your Azure subscription. This way, we can deploy resources to the Azure environment. We will use a managed identity and create a service connection in Azure DevOps to achieve this.

  1. On the Azure DevOps initial...

Configuring Azure Repos

Azure Repos is a version control service provided by Microsoft as part of its Azure DevOps platform. It helps developers to manage and track changes to their code base, collaborate with team members, and maintain different versions of their code.

Azure Repos provides features such as Git and Team Foundation Version Control (TFVC) systems, pull requests, code reviews, and more, making it easier for teams to work together on code development and delivery.

To configure Azure Repos, go to the Azure DevOps main page, and in the left menu, select the Repos option. Then, you will see a page with multiple options to configure your source code. In the left menu, under Repos, there’s a drop-down menu that includes Files, Commits, Pushes, Branches, Tags, and Pull requests. On the right-hand side, we have options to import a repository:

Figure 12.6 – Azure Repos overview

Figure 12.6 – Azure Repos overview

The repository includes three tiers:

  • Tier1...

Configuring a build pipeline in Azure DevOps using the Classic Editor

Under Azure Repos, you can configure Azure Pipelines. Follow these steps:

  1. Go to the Pipelines section and then select Create Pipeline:
Figure 12.11 – Create Pipeline

Figure 12.11 – Create Pipeline

  1. Next, select the Use the classic editor option, as shown here:
Figure 12.12 – Use the classic editor

Figure 12.12 – Use the classic editor

  1. Then, select the repository and the master branch and then select the Continue option:
Figure 12.13 – Azure Pipelines – Select a source

Figure 12.13 – Azure Pipelines – Select a source

  1. Next, select the option to start with an empty job:
Figure 12.14 – Azure Pipelines – Select a template

Figure 12.14 – Azure Pipelines – Select a template

  1. Now, provide the configuration for the pipeline. Provide a name for this pipeline. We will name it SpringToysApp-CI. Then, in the left pane, where it says Agent job 1, select this option and then click on the plus...

Configuring a release pipeline in Azure DevOps using the Classic Editor

To configure a release pipeline, follow these steps:

  1. In Azure DevOps, go to the Pipelines section and select the Releases option:
Figure 12.23 – Azure Pipelines – Releases

Figure 12.23 – Azure Pipelines – Releases

  1. Next, create a new pipeline and select the Empty job option, as shown here:
Figure 12.24 – Azure Pipelines – Empty job

Figure 12.24 – Azure Pipelines – Empty job

  1. Provide a name for this stage, Dev, and save it:
Figure 12.25 – Azure Pipelines – Stage

Figure 12.25 – Azure Pipelines – Stage

  1. Then, we will add the artifacts. These artifacts will be the Bicep files: the automation account, the SQL database, the storage account, and the virtual network. On the same page, select the + Add an artifact option:
Figure 12.26 – Azure Pipelines – Artifacts

Figure 12.26 – Azure Pipelines – Artifacts

  1. Select the build pipeline related to the resources in Tier1, and...

Configuring Azure Pipelines with YAML

In this section, we will perform the steps to configure an Azure pipeline with YAML:

  1. Sign in to your Azure DevOps account and navigate to the project where you want to create the pipeline.
  2. Then, click on the Pipelines tab on the left, and click on the New pipeline button to start creating a new pipeline, as shown here:
Figure 12.37 – Azure Pipelines – New pipeline

Figure 12.37 – Azure Pipelines – New pipeline

  1. In the Where is your code? section, select the repository where your code is located. Azure DevOps supports various version control systems such as Azure Repos, GitHub, and Bitbucket.

We will select Azure Repos Git YAML, as shown here:

Figure 12.38 – Azure Pipelines – Where is your code?

Figure 12.38 – Azure Pipelines – Where is your code?

Azure DevOps will analyze your repository and suggest a YAML template based on the project type and existing configuration. If the suggested template matches your requirements, you can choose...

Summary

With Azure Pipelines, organizations can automate their software development pipeline, reducing the risk of errors and freeing up development teams to focus on creating high-quality software.

This chapter reviewed how you can get started with Azure DevOps and configure your repository using Azure Repos. Then, we created a few build pipelines and release pipelines. Finally, we created a release pipeline and verified the creation of a resource in our Azure environment.

The next chapter will review how you can enable CI and continuous deployment with Azure Pipelines.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Azure Architecture Explained
Published in: Sep 2023Publisher: PacktISBN-13: 9781837634811
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
David Rendón

David Rendón, Microsoft MVP and Microsoft Certified Trainer, is a highly regarded expert in the Azure cloud platform. With over 15 years of experience as an IT professional, he has been deeply committed to Microsoft technologies, especially Azure, since 2010. With a proven track record of leading and driving strategic success, David has over seven years of management experience, technical leadership, and collaboration skills. David delivers private technical training classes worldwide, covering EMEA, South America, and the US, and he is a frequent speaker at renowned IT events such as Microsoft Ignite, Global Azure, and local user group gatherings in the US, Europe, and Latin America.
Read more about David Rendón

author image
Brett Hargreaves

Brett Hargreaves is a principal Azure consultant for Iridium Consulting, who has worked with some of the world's biggest companies, helping them design and build cutting-edge solutions. With a career spanning infrastructure, development, consulting, and architecture, he's been involved in projects covering the entire solution stack using Microsoft technologies. He loves passing on his knowledge to others through books, blogging, and his online training courses.
Read more about Brett Hargreaves