4
votes

I'm currently using Azure hosted build agents on Visual Studio Team Services. Now, I've installed a build agent on-premise and successfully configure it to run as part of the Default agent pool. I can also change my projects to use the Default agent pool and everything works as expected.

My question is this: is it possible to configure a project or agent pool to contain build agents from both on-premise and Azure hosted? I would like VSTS to pick my on-premise build agent first (and if available). If a build is already running on this agent or if it is not available, I would like VSTS to pick a build agent hosted on Azure. This way, I can run most builds on-premise, but utilize Azure if I run out of build slots locally or if my server is unavailable.

1
The short answer is no. You can not register a private agent in the Hosted agent pool. And there is no way to choose agent dynamically.Marina Liu

1 Answers

3
votes

As I understand when you mean azure hosted agent, you are saying an agent hosted on a Azure virtual machine.

Having this premise in mind ... yes you can do it.

First, create a new agent pool and agent queue. Then install your on-premise agent, pointing it to your new agent queue. The order is important here, because de queue will pick the first available agent.

After that, install your agent on the Azure VM, pointing it to your newly created agent queue.

This way, the queue will look always first at your on-premise agent. If it is available it will go using it. If is not, it will pick the next available agent, which will be your Azure agent.

If by Azure hosted agent you mean a VSTS Hosted Agent, then no, you can not add both of them on the same pool and queue.