1
votes

In Azure Devops, how to identify a self hosted agent from existing agents. I would like my custom build task to be allowed to execute in self hosted agent only.

1

1 Answers

3
votes

You can take advantage of the custom capabilities defined for agents and demands specified in the build pipeline. As noted here:

The agent software automatically determines various system capabilities such as the name of the machine, type of operating system, and versions of certain software installed on the machine. Also, environment variables defined in the machine automatically appear in the list of system capabilities.

Thus, your self-hosted agents can define some special environment variable, which will then be demanded by the build process.