Setting up Azure DevOps agent in Windows Subsystem for Linux

Windows Subsystem for Linux gives us the option to run our favorite Linux Distributions from Windows OS itself, On how to enable it you can see it over here

Let us see how to install an Azure DevOps agent on it and autostart is as a service so that we can use Linux for some of our pipelines.

Installing an Azure DevOps agent in Windows Subsystem for Linux

Step1: Login to the Windows and open your Linux Distribution (In my case it’s ubuntu)

Step2: Now create a folder where you want to have your agent,(Either you can create it somewhere in the home directory or Drivers like C,D, E etc.,) Let us create a directory under the home itself and call it as _AzureDevOpsAgent

You can see more about adding an agent Pool over here

Step 3: Then download the agent as shown

Step 4: Once the agent file has been downloaded, rename it and extract it by these commands

cd _AzureDevOpsAgent
tar zxvf ~/vsts-agent-linux-x64-2.171.1.tar.gz

Step 5:

Step 6: Enter the AzureDevOps url and then the PAT Token, Agent Pool and finally the agent name

Step 7: Then execute the script to run the agent interactively

This shows Agent has started running and you can check the same in AzureDevOps also

Step 8: Go to the Private Agent Pool and check under the agents, you can see the agents we have configured running

Step 9: Though the agent is up and running, it’s running in interactive mode, Since it’s also WSL there are some issues in starting it, so the best way is to make it run is to have a task scheduler and with these commands

"ubuntu.exe run "/home/shan2009/_AzureDevOpsAgent/"

Step 10: Add a task that will be running on the startup as shown such that it runs the agent interactively at the startup

The commands to start the agent will be

ubuntu.exe run "/home/shan2009/_AzureDevOpsAgent/"

Add these commands in the bat file and execute the bat file on System startup under any account name.Now create the task and then restart the system to see whether agent comes online without any manual intervention (This works in almost all the Windows servers)

You may also like...

11 Responses

  1. December 7, 2020

    … [Trackback]

    […] Find More on that Topic: […]

  2. December 12, 2020

    … [Trackback]

    […] Read More on that Topic: […]

  3. December 19, 2020

    … [Trackback]

    […] Info on that Topic: […]

  4. December 19, 2020

    … [Trackback]

    […] Find More on that Topic: […]

  5. December 20, 2020

    … [Trackback]

    […] Read More on on that Topic: […]

  6. December 29, 2020

    … [Trackback]

    […] There you can find 60145 additional Info to that Topic: […]

  7. January 6, 2021

    … [Trackback]

    […] Information on that Topic: […]

  8. January 6, 2021

    … [Trackback]

    […] There you can find 2076 more Information to that Topic: […]

  9. January 15, 2021

    … [Trackback]

    […] Here you will find 93441 more Information on that Topic: […]

  10. January 16, 2021

    … [Trackback]

    […] Read More on that Topic: […]

  11. January 20, 2021

    … [Trackback]

    […] Find More Info here on that Topic: […]