Professional Documents
Culture Documents
Prepare permissions
Decide which user you'll use
As a one-time step, you must register the agent. Someone with permission to administer the agent
queue1 must complete these steps. The agent will not use this person's credentials in everyday
operation, but they're required to complete registration. Learn more about how agents communicate2.
1
reference: https://docs.microsoft.com/en-us/azure/devops/organizations/security/about-security-
roles?view=azure-devops#agent-queue-security-roles
2
reference: https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-
devops&tabs=browser#communication
4. Copy the token. You'll use this token when you configure the agent.
1. Open a browser and navigate to the Agent pools tab for your Azure Pipelines organization or
Azure DevOps Server or TFS server:
a. Choose Azure DevOps, Organization settings.
2. Click the pool on the left side of the page and then click Security.
3. If the user account you're going to use is not shown, then get an administrator to add it. The
administrator can be an agent pool administrator, an Azure DevOps organization owner, or a
TFS or Azure DevOps Server administrator.
You can add a user to the deployment group administrator role in the Security tab on the
Deployment Groups page in Azure Pipelines.
Note
If you see a message like this: Sorry, we couldn't add the identity. Please try a different identity.,
you probably followed the above steps for an organization owner or TFS or Azure DevOps Server
administrator. You don't need to do anything; you already have permission to administer the
agent queue.
1. Log on to the machine using the account for which you've prepared permissions as explained
above.
2. In your web browser, sign in to Azure Pipelines, and navigate to the Agent pools tab:
a. Choose Azure DevOps, Organization settings.
3. Select the Default pool, select the Agents tab, and choose New agent.
4. On the Get the agent dialog box, choose Windows.
5. On the left pane, select the processor architecture of the installed Windows OS version on your
machine. The x64 agent version is intended for 64-bit Windows, whereas the x86 version is
intended for 32-bit Windows. If you aren't sure which version of Windows is installed, follow
these instructions to find out.
6. On the right pane, click the Download button.
7. Follow the instructions on the page to download the agent.
8. Unpack the agent into the directory of your choice. Then run config.cmd. This will ask you a
series of questions to configure the agent.
Note
We strongly recommend you configure the agent from an elevated PowerShell window. If you
want to configure as a service, this is required.
When setup asks for your server URL, for Azure DevOps Services, answer https://dev.azure.com/{your-
organization}.
When setup asks for your authentication type, choose PAT. Then paste the PAT token you created into
the command prompt window.
Note
When using PAT as the authentication method, the PAT token is only used during the initial
configuration of the agent. Later, if the PAT expires or needs to be renewed, no further changes
are required by the agent.
For guidance on whether to run the agent in interactive mode or as a service, see Agents: Interactive vs.
service.
If you choose to run as a service (which we recommend), the username you run as should be 20
characters or less.
PowerShell command:
.\run.cmd
To restart the agent, press Ctrl+C to stop the agent and then run run.cmd to restart it.
Run once
For agents configured to run interactively, you can choose to have the agent accept only one job. To run
in this configuration:
PowerShell command:
.\run.cmd --once
Agents in this mode will accept only one job and then spin down gracefully (useful for running on a
service like Azure Container Instances).
The result should look somewhat like this:
To control this agent you can choose to install it as a service on Windows or you can choose to run the
agent from the command line. To start and stop the agent I added two scripts:
Start.cmd:
Start.cmd:
cd c:
cd \EK-VSTS-Agent
exit
Stop.cmd:
*Important note: This solution will only work when you do NOT have a .gitignore file in your repository*
2. Under Pipelines, click Builds tab. Click the New pipeline button.