8

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

1 Answers1

7

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.

  • Hi @MatthiasSchuchardt, thanks for sharing your experiences. Please mark your answer as the solution of this topic. This may be also very helpful to other people who are looking for a solution for the similar questions. Thanks. – Bright Ran-MSFT Mar 15 '21 at 03:13
  • @MatthiasSchuchardt, it truly works! Made my day ;) – Rodion Sychev Apr 23 '21 at 22:35