Cloud Service >> Knowledgebase >> General >> Steps to Configure Self-Hosted Agents in Azure DevOps
submit query

Cut Hosting Costs! Submit Query Today!

Steps to Configure Self-Hosted Agents in Azure DevOps

Follow these detailed steps to set up self-hosted agents in Azure DevOps, which cover the prerequisites, installation, and maintenance of agents. Self-hosted agents provide essential flexibility and control for your CI/CD pipeline environment to meet specific project needs.

 

Understanding Self-Hosted Agents

Self-hosted agents are machines you configure and oversee to execute tasks within Azure DevOps. They offer the option to install and set up software that may not be accessible on Microsoft-hosted agents, enabling personalized builds and deployments. This flexibility is particularly useful for projects requiring specific tools or configurations.

 

Benefits of Self-Hosted Agents

Cost Efficiency: Self-hosted agents can run jobs with unlimited minutes, while Microsoft-hosted agents have a limited free tier and additional costs for more usage.

Customization: You can install any software needed for your builds, making it easier to meet unique project requirements.

Performance: Self-hosted agents can maintain machine-level caches and configurations, improving build times.

Prerequisites

Ensure that the setup of the self-hosted agent is in an environment with specific characteristics:

Operating System: The compatibility versions are Windows 7 SP1, Windows 10, or Windows Server 2012 and above or different Linux distributions.

Software Requirements: Ensure one has Power Shell 3 on the Windows. For Windows, ensure that you have at least 0 or higher installed, while for Linux, ensure that all the necessary dependencies for your builds have been met.

Network Access: The agent must have internet access to communicate with Azure DevOps services.

Steps to Configure Self-Hosted Agents

Step 1: Access Azure DevOps

Sign in to your Azure DevOps profile using https://dev.azure.com/{your-organization}.

 

Step 2: Create an Agent Pool (Optional)

For better organization, create a new agent pool:

Navigate to Organization settings > Agent Pools.

Click Add Pool to create a new agent pool.

Step 3: Download the Agent Package

Select the agent pool you wish to use.

Click on New Agent.

Select an operating system (Windows, Linux, or macOS) and obtain the agent package by downloading it.

Step 4: Extract the Agent Package

Unpack the downloaded agent package to a directory of your choice. For example, on Windows, you might use:

cd C:\agents

 

Step 5: Configure the Agent

Run the configuration script:

 

For Windows, execute:

 

.\config.cmd

 

For Linux, execute:

 

./config.sh

 

While setting up, you will be asked to give information:

 

Server URL: For Azure DevOps Services, use https://dev.azure.com/{your-organization}.

Authentication Type: Choose from:

Personal Access Token (PAT)

Alternate authentication methods (Basic, Negotiate, or Integrated for Windows).

 

Step 6: Choose Agent Mode

Decide whether to run the agent in interactive mode or as a service. Running as a service is recommended for better management and stability.


Step 7: Configure Agent Capabilities (Optional)

After installation, you can define capabilities for your agent:

Go to Project Settings> Agent Pools.

Select your agent pool and click on your agent.

Under the Capabilities tab, you can add new capabilities as needed.

 

Step 8: Use Your Self-Hosted Agent

In your build or release pipeline configurations, specify your preference for a self-hosted agent by selecting the agent pool containing your self-hosted agent.

Step 9: Monitor and Maintain the Agent

Regularly check the status of your self-hosted agent in Azure DevOps. Keep the agent updated and consult logs for troubleshooting if issues arise.

Conclusion

Setting up self-hosted agents in Azure DevOps provides more flexibility and control of your CI/CD processes. By adhering to the steps provided, you can efficiently establish and oversee agents designed for your project's distinct requirements. This arrangement improves your workflow and guarantees that your builds and deployments are performed in a controlled environment that fulfils all essential criteria.

Using self-hosted agents, you can make the most of your infrastructure to enhance your software development and deployment procedures, turning them into a crucial resource within your DevOps toolkit.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!