Azure Self-Hosted Agent Installation
Creating a Personal Access Token
- Log into Azure DevOps.
- Under User settings select
Personal access tokens
- Click
New Token
- Fill the
Name
andExpiration
fields. - In scope select
Custom defined
, then clickShow all scopes
and tickRead & manage
underAgent Pools
- Click
Create
and make sure to securely store the token because it will not be accessible later.
Installing and configuring the agent
-
- If you want the agent to be usable by different projects in your organization go to
Organization Settings
on your Azure Devops Organization page. - If you want the agent to be exclusive to a specific project, go to
Project Settings
on the Azure Devops Project page.
- If you want the agent to be usable by different projects in your organization go to
-
Select
Agent pools
under thePipelines
section on the left - Select an existing
Agent Pool
or create a new one. - After you've selected an
Agent Pool
, clickNew Agent
- Linux:
- Select
Linux
- Press the Copy button next to the Download button to copy the URL.
- Select
- Linux:
Linux
In the Linux machine:
- Create a user for the Azure Agent:
- Add the user to sudoers:
- If needed add the user to other necessary groups like
docker
: - Create any necessary working directories and grant ownership to the user:
- Switch to the azureagent user and navigate to the
/home/azureagent
directory: - Download the agent using the URL we copied earlier:
- Create a new directory for the agent and extract the tar.gz inside and confirm with ls:
- Run the config script to start the agent configuration:
-
Provide the info requested by the script
- Enter your Azure Devops server URL:
- Press Enter to continue using PAT then paste the PAT we created earlier.
- Enter the agent pool name and a name for the agent we're creating.
- Press enter to use the default work folder (
_work
)
-
Configure the agent to run as a service:
-
Navigate to the
Agent pools
page on Azure Devops and select the relevantAgent Pool
, then click on theAgents
tab to verify that our newAgent
is added as a self-hosted agent.