Agent Pools in Azure

Agent Pools in Azure

In the last Post We talk about the creation of Azure Pipelines. Today we will talk about the creation of agent pools in Azure Devops.

To use Azure Pipelines for building and deploying code, you need at least one build agent. There are two types of build agents: Microsoft-hosted and self-hosted. Microsoft-hosted build agents are provided by default and can be found in the Azure Pipelines agent pool. For self-hosted build agents, you can create a new agent pool and assign your agents to it. Each agent type is organized within an agent pool, which is a collection of build and release agents.

To create pools, follow these steps:        

1. Click on your project name in the web portal and click Project settings | Agent pools | Add pool:

Adding a Pool

2. Enter the information shown in the following screenshot and then click Create:

Creating a Agent Pool

3. Finally, you will see the new agent pool:

Displaying the new agent pool

After creating the new agent pool, you can proceed with setting up the self-hosted agent within this pool. The following section will guide you through creating a personal access token (PAT).

Creating a PAT

Before you can create self-hosted agents on your server or machine, you must create a PAT. To do this, follow these instructions:

1. Go to the Settings menu under your personal icon and click on Personal access tokens:

Creating PATs

2. Click on New Token:

New Tokens

3. Enter the required information:

Name: Enter the name you need

Organization: Select an organization you will link to

Expiration (UTC): There are four choices – 30 days, 60 days, 90 days, and custom-defined but under 2 years

Scopes: Select Custom defined | Agents Pools with Read & manage | Auditing with Read Audit Log:


Entering the required information

4. Copy the PAT before clicking on the Close button as you won’t be able to see it again:

Copying the PAT

Now, you are ready to set up a self-hosted agent.


Setting up self-hosted agents

After you’ve created a PAT, you can create a new self-hosted agent under a new agent pool. To do this, follow these steps:

1. Click on PacktAzureDevOps | Agent pools | General:

Entering a new agent pool

2. Click on New agent:

Entering a new agent

3. You can download a self-hosted agent based on your operating system. Three operating system options are available for download and setup:

- For Windows users, the build agent software can be downloaded from the Windows tab. Two options are available, as shown in the following screenshot: Windows 64-bit (x64) and Windows 32-bit (x86).

The Windows agent for setting up a file

To set up a Windows agent, you need to run on PowerShell as an administrator.

Mac users can download build agent software from the macOS tab:

MacOS agent

You don’t need to use the bash command in the administrator role to set up the macOS agent.

Linux users can download build agent software from the Linux tab. There are four options for computer architecture – x64, ARM, ARM64, and RHEL6:

Linux agent

You don’t need to use a root user for installation to set up a Linux agent.

4. After configuring the agent in each operating system, you must enter the following information:

5. Once you start the service, you will see that agent01 is active:

Agent status dashboard

6. You can see the Online status of the build agent that has already been created:

Action menu of the agent

7. You can delete the agent and update to a new version of the agent by clicking on the button with the ellipses or three dots.

You are now ready to create the build and deployment on the agent01 build agent. However, you need to set up the deployment group so that you can deploy your application on a local web server such as Microsoft Internet and Information Services (IIS). We’ll do this in the next section.

Setting up deployment groups

Deployment groups are logical collections of agents used for application deployment on target machines, organized by environment. They are usually named according to project requirements and promotion stages before reaching production. Agents are installed in each environment, with support for both Windows and Linux operating systems.

To create a deployment group, follow these instructions:

1. Navigate to Pipelines | Deployment groups | Groups | Add a deployment group:

Adding a deployment group

2. Enter the required information and click Create:

Entering deployment group information

3. After creating the deployment group, you must set up the deployment agent under your deployment group. There are two operating systems the deployment agents support:

-Windows users can install an agent of the deployment group by copying the PowerShell script and running it with an administrator command prompt:

Script to deploy an agent on Windows

Linux users can install an agent of the deployment group by copying the bash shell script and running it with an administrator command prompt:

Script to deploy an agent on Linux

4. After setting up the agent for deployment groups, you will see that the build agent of the deployment group is online:

The deployment agent is online

After setting up the build and deployment agent on a self-hosted computer, you are ready to create your first Azure pipeline.

In the last few Post, We explored the key concepts of CI/CD within Microsoft's Azure DevOps service. We gained an understanding of the basic structure of Azure Pipelines YAML and how Azure Pipelines compares to other available services. We also covered the fundamentals of Azure Pipelines, equipping us to prepare the CI/CD pipelines for the real-world scenarios. Lastly, we learned how to set up agent pools, deployment groups, and self-hosted agents, laying the groundwork for the hands-on projects.


Microsoft Learn Microsoft Azure Microsoft Azure DevOps


















要查看或添加评论,请登录

社区洞察

其他会员也浏览了