microsoft / VSTSAgent.PowerShell

Tools for managing and automating your Azure DevOps Agents.
MIT License
29 stars 23 forks source link

Install as environment resource #32

Closed erik-source closed 2 years ago

erik-source commented 2 years ago

Will these tools support installing the agent as an environment VM resource?

The docs are sparse but pulling from the generated script this seems to mean supporting the options --environment and --environmentname "my-env"

jwittner commented 2 years ago

I'm not familiar with what you mean by an 'environment VM resource'. This project largely deals with the Azure DevOps Agent documented here.

erik-source commented 2 years ago

I'm referring to Environment Virtual Machine Resources.

The docs you linked briefly touch on it in the Environments Only section (though they seem incomplete).

The registration script that it generates following the steps in the documentation seems to download and register an agent normally, but with the addition of the two environment options.

Here's a formatted snippet of what Azure DevOps generates as the registration script

# Ommitted for brevity

$Uri = 'https://vstsagentpackage.azureedge.net/agent/2.195.2/vsts-agent-win-x64-2.195.2.zip';

# Ommitted for brevity

.\config.cmd --environment `
  --environmentname $EnvironmentName `
  --agent $env:COMPUTERNAME `
  --runasservice `
  --work '_work' `
  --url 'my-devops-url' `
  --projectname 'my-project' `
  --auth PAT `
  --token $PAT;
jwittner commented 2 years ago

Looks like a great feature to support, but not currently on the roadmap for our needs. More than happy to review a PR that adds support for these flags though! =)

Adding an 'AdditionalArguments' parameter would be good too - so that this API can be leveraged without it needing to stay in sync with the underlying tooling.

erik-source commented 2 years ago

Thanks for the prompt replies! My powershell skills are lacking, but I'd certainly be willing to try my hand at a PR

jwittner commented 2 years ago

Changes are now available on the PS gallery as of version 2.0.12-develop.