Azure DevOps - Self-hosted agents

 Self-hosted agents An agent that you set up and manage on your own to run jobs is a self-hosted agent. You can use self-hosted agents in Az...

 Self-hosted agents

An agent that you set up and manage on your own to run jobs is a self-hosted agent. You can use self-hosted agents in Azure Pipelines or Azure DevOps Server, formerly named Team Foundation Server (TFS). Self-hosted agents give you more control to install dependent software needed for your builds and deployments. Also, machine-level caches and configurations persist from run to run, which can boost speed.

You can install the agent on different OS. There are different agents on different OS

  • macOS agent
  • Linux agent (x64, ARM, ARM64, RHEL6)
  • Windows agent (x64, x86)
  • Docker agent

Self-hosted Windows agents


  • Windows 7 SP1 ESU, 8.1, 10, or 11 (if using a client OS)
  • Windows 2012 or higher (if using a server OS)
  • PowerShell 3.0 or higher
  • .NET Framework 4.6.2 or higher 

Authenticate with a personal access token (PAT)

  1. Sign in with the user account you plan to use in your Azure DevOps organization ({your_organization}).
  1. From your home page, open your user settings, and then select Personal access tokens.

    Go to your security details.

  2. Create a personal access token.

    Create a personal access token.

  1. For the scope select Agent Pools (read, manage) and make sure all the other boxes are cleared. If it's a deployment group agent, for the scope select Deployment group (read, manage) and make sure all the other boxes are cleared.

    Select Show all scopes at the bottom of the Create a new personal access token window window to see the complete list of scopes.

  2. Copy the token. You'll use this token when you configure the agent.

Confirm the user has permission

Make sure the user account that you're going to use has permission to register the agent.

Is the user an Azure DevOps organization owner or TFS or Azure DevOps Server administrator? Stop here, you have permission.


  1. Open a browser and navigate to the Agent pools tab for your Azure Pipelines organization or Azure DevOps Server or TFS server:

    1. Choose Azure DevOpsOrganization settings.

      Choose Organization settings.

    2. Choose Agent pools.

      Choose Agent pools tab.

  2. Azure pipeline Agent pool is used for MS-hosted agents and Default is used for self-hosted agents.

  3. Click on Default and then click on the New Agent button.

  4. It will open the set of instructions to Download Agent and install agent so follow those instructions and install the agent on a windows machine.

  5. Server URL:- Enter URL for Organization like

  6. PAT:- Personal Access Token which is created in user profile.

  7. Agen Pool:- Default

  8. Agent Name:- provide any valid name or press enter for default name

  9. Work folder:- Press Enter or you can provide any folder where you want to keep the artifacts.

  10. Enter run agent as a service:- Press Enter for N if you want to run as a windows service then you can choose Y.

  11. Enter Configure Autologon and Run agent on Startup: Press Enter for N and Y for yes.

  12. Under this folder run the command .\run.cmd

  13. Check Agent pool --> Default Pool and you will find the Agent is created and has Online Status.

  14. Create a new pipeline or Edit any existing pipeline by providing the below code. In this example, RAMAN-SHARMA is the agent which is created in the Default Agent pool. After writing the code Run the pipeline (It will ask the permission to allow the user to execute the pipeline, so provide the permission by clicking on the Permit button)

    # Build and test ASP.NET Core projects targeting the full .NET Framework.
    # Add steps that publish symbols, save build artifacts, and more:

    - master
    #Define the Agent pool configuration here. RAMAN-SHARMA is agent Name
      name: 'Default'
      vmImage: 'RAMAN-SHARMA'

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

    - task: NuGetToolInstaller@1

    - task: NuGetCommand@2
        restoreSolution: '$(solution)'

    - task: VSBuild@1
        solution: '$(solution)'
        msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\" /p:DeployIisAppPath="Default Web Site"'
        platform: '$(buildPlatform)'
        configuration: '$(buildConfiguration)'
  15. Once the Job is executed successfully you will find the artifacts in the configured directory.



Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,git quiz,1,Git Worksheet,1,Jira,3,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SDLC Quiz,4,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
DevOpsWorld: Azure DevOps - Self-hosted agents
Azure DevOps - Self-hosted agents
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content