Articles → AZURE DEVOPS → Self-Hosted Agent In Azure Devops

Self-Hosted Agent In Azure Devops





  1. Create an agent pool
  2. Create Personal Access Token
  3. Install agent on the machine
  4. Change the agent pool of the pipeline
  5. Change in yaml file
  6. Queue the build

Create An Agent Pool




Picture showing the Project settings option in the Azure Devops
Click to Enlarge



Picture showing the Agent Pools options inside the Project settings option in the Azure Devops
Click to Enlarge



Picture showing the Agents pools screen with the list of pools
Click to Enlarge



Picture showing the window for adding a new agent pool
Click to Enlarge




Create Personal Access Token




Picture showing the Personal access tokens option in the menu
Click to Enlarge



Picture showing the New Token button for adding the new token
Click to Enlarge



Picture showing the screen where you can enter the token information and generate the token
Click to Enlarge



Picture showing the token generated in Devops
Click to Enlarge


Install The Agent On The Local Machine




Picture showing the list of agent pools in DevOps
Click to Enlarge



Picture showing the New agent button for adding the new agent
Click to Enlarge





Picture showing the download button for downloading the agent for self-hosting
Click to Enlarge





Picture showing the extracted files from the agent folder downloaded in the previous step
Click to Enlarge



# The code will run “config.cmd”.
./config.cmd




  1. Server URL
  2. PAT
  3. Agent pool
  4. Picture showing the powershell window for executing the config.cmd file and configuring the self-hosted agent
    Click to Enlarge




./run.cmd


Picture showing executing the run.cmd file in powershell for making an agent online
Click to Enlarge


Change The Agent Pool Of The Pipeline




Picture showing the list of all pipelines in the Azure Devops
Click to Enlarge



Picture showing the Edit button for editing the pipeline
Click to Enlarge



Picture showing the Triggers inside the selected pipeline
Click to Enlarge



Picture showing selecting the self-hosted agent in the pipeline
Click to Enlarge


Change In The Yaml File




# ASP.NET Core (.NET Framework)
# Build and test ASP.NET Core projects targeting the full .NET Framework.
# Add steps that publish symbols, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core

trigger:
- master

pool:
  name: myagentpool
  demands:
    - agent.name -equals DESKTOP-85KOUP0

variables:
  solution: '**/*.sln'
  buildPlatform: 'Any CPU'
  buildConfiguration: 'Release'

steps:
- task: NuGetToolInstaller@1

- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'



Queue The Build




Picture showing executing the build using self-hosted agent
Click to Enlarge



Picture showing the artifacts added in the self-hosted agent
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, July 7, 2021

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250