azure devops agent

Azure DevOps Agent selfhost

Azure DevOps is a simple and fast way to build and deploy different kind of projects with the free Microsoft-hosted agent. Sometimes it can make sense to have a local agent, for example to deploy to a local virtual machine for testing purposes as you don’t always want to pay extra money for staging systems.

Instructions

  • 1. First of all we need to go to the DevOps Portal https://dev.azure.com/

  • 2. Enter the “Organization Settings”. Under “Pipelines” > “Agent pools” we need to add a new Pool

  • 3. Choose “Self-Hosted” 
  • 4. After creating the Pool, click on it and press “New agent” on the upper right corner

  • 5. Depending on which operating system you are using, choose the tab for that. As we use Linux, we will follow with that

  • 6. Download the agent via command line by clicking on the copy button next to the blue download button and wget the tarball:

				
					mkdir ~/azagent
cd ~/azagent
wget https://vstsagentpackage.azureedge.net/agent/2.183.1/vsts-agent-linux-x64-2.183.1.tar.gz
				
			

 

  • 7. Before you can call the configuration script you need to create a token the agent can authenticate with in the next step

 

  • 8. Choose your organisation, Expiration to something far in future and scope “Full access”

  • 9. Next you can extract the tarball and call the config script

				
					tar -xvf vsts-agent-linux-x64-2.183.1.tar.gz
sh ./config.sh
				
			
 
  • 10. You will be asked for your organisation and the access token we created in Step 7

  • 11. That’s it, you should see your Agent now under Organization Settings > Agent Pools > Your Agent Pool > Agents

  • 12. To use your newly created agent you now just have to define the pool in your azure-pipelines.yml file