Skip to content

Instantly share code, notes, and snippets.

@ducas
Last active May 23, 2017 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducas/0e60ddc2c1f36f8f202d5533220ab8ef to your computer and use it in GitHub Desktop.
Save ducas/0e60ddc2c1f36f8f202d5533220ab8ef to your computer and use it in GitHub Desktop.
Setting up a VS2017 Build Agent
$agentUrl = 'https://github.com/Microsoft/vsts-agent/releases/download/v2.112.0/vsts-agent-win7-x64-2.112.0.zip'
$vstsUrl = '' # TODO: Set URL - e.g. https://mytenant.visualstudio.com
$pat = '' # TODO: set PAT generated using these instructions - https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows
$pool = 'default'
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# change this or add more steps below to install any other prerequisites
choco install -y `
visualstudio2017community `
visualstudio2017-workload-netcoretools `
visualstudio2017-workload-netweb `
visualstudio2017-workload-node `
docker-machine `
mongodb
if ( -not ( Test-Path C:\agent ) ) {
mkdir C:\agent
}
pushd C:\agent
iwr $agentUrl -OutFile agent.zip
Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory("$PWD\agent.zip", "$PWD")
.\config.cmd --unattended --url $vstsUrl --auth PAT --token $pat --pool $pool --agent $env:COMPUTERNAME --runasservice
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment