Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install multiple Azure DevOps environment agents on server

We have a dev server hosting webservices from multiple Azure DevOps projects. To use yaml deployment pipelines, we migrated from deployment pools to environments/resources. Unlike deployment pools neither environments nor resources can be shared between projects. You can upvote here to change that.

We work around this as follows.

  1. Create an environment for each project.
  2. For each environment add the dev server as a resource.
  3. Install one environment agent per project on the server.

Unfortunately, this creates a naming conflict if there is already an environment agent installed on the server.

The service already exists: vstsagent.MyDevOpsAccount..MyServer, it will be replaced
Error: Operation CreateService failed with return code 1072
like image 449
Matthias Schuchardt Avatar asked Apr 28 '26 02:04

Matthias Schuchardt


1 Answers

TLDR: In the powershell installation script, change --agent $env:COMPUTERNAME to --agent "$env:COMPUTERNAME-MyProject"

The reason seems to be that the windows service name of the agent is determined as follows.

serviceName = StringUtil.Format(serviceNamePattern, accountName, settings.PoolName, settings.AgentName);

It uses the Azure DevOps organization name, the name of the deployment pool and the agent name. Since the organization name is fixed and the deployment pool name unavailable for environment agents, the agent name seems to be the only chance.

like image 147
Matthias Schuchardt Avatar answered Apr 30 '26 13:04

Matthias Schuchardt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!