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
NameandExpirationfields. - In scope select
Custom defined, then clickShow all scopesand tickRead & manageunderAgent Pools - Click
Createand 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 Settingson your Azure Devops Organization page. - If you want the agent to be exclusive to a specific project, go to
Project Settingson the Azure Devops Project page.
- If you want the agent to be usable by different projects in your organization go to
-
Select
Agent poolsunder thePipelinessection on the left - Select an existing
Agent Poolor 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/azureagentdirectory: - 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 poolspage on Azure Devops and select the relevantAgent Pool, then click on theAgentstab to verify that our newAgentis added as a self-hosted agent.