Azure-devops-docs: How do I share environments across projects?

Created on 9 Jun 2020  ·  8Comments  ·  Source: MicrosoftDocs/azure-devops-docs

How do I share environments across projects?

We have organized our software in many different projects. However, we deploy most of our software to the same physical machines: Development, Staging, and Production.

From the looks of it, do I need to run the PowerShell registration script for each project environment? Why can't I share environments across projects?

Thanks for clarifying!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 cba devops-cicd-procestech devopprod product-feedback

All 8 comments

@stevenvolckaert Thank you for the question.

Currently this can only be handled with custom scripting using PowerShell, etc.

If you'd like to see this as an added feature, please refer this post for status updates from the product team.

@msebolt Thank you for your response 🙏

I've managed to 'share' environments by registering multiple Azure Pipeline Agents, indeed via modifying the PowerShell script. At the moment, each server (e.g. 'Development', 'Staging', 'Production'), is now running one agent per project.

Is this the workaround that you are referring to?

If you mean something else, I'm curious what it could be! 🤓

@stevenvolckaert You're welcome!

Yes, I was mainly referring to sharing variables (a work still in progress). Sharing environments would likely be considered once this is complete.

Closing this issue now, thanks again for the feedback and please contact us again for further discussion or changes needed to the documentation.

Thanks again @msebolt!!

Could you please elaborate the changes you maid in the PowerShell script.
I am facing the issue while installing the Azure pipeline agent on one VM where Azure self hosted agent already installed.
Below is the output of the error....

Connect:

Connecting to server ...

Register Agent:

Scanning for tool capabilities.
Connecting to the server.
Enter Environment Virtual Machine resource tags? (Y/N) (press enter for N) >
Successfully added the agent
Testing agent connection.
2020-08-07 11:43:16Z: Settings Saved.
Enter User account to use for the service (press enter for NT AUTHORITY\SYSTEM) >
The service already exists: vstsagent.company..WEBSERVER01, it will be replaced
Error reported in diagnostic logs. Please examine the log for more details.
- C:\azagent\A4_diag\Agent_20200807-114307-utc.log
Could not delete service 'vstsagent.company..WEBSERVER01'

@Satendrakumar-hatteland See my adapted PowerShell registration script Register-AzurePipelinesAgent.ps1. Hope it helps!

@stevenvolckaert This fixed the issue for me, thanks! I was getting the same "could not delete service" error that @Satendrakumar-hatteland was getting.

Was this page helpful?
0 / 5 - 0 ratings