Reputation: 2755
I´m trying to automate VSTS Build Agent Setup (https://www.visualstudio.com/en-us/docs/build/actions/agents/v2-windows).
However there's an interactive step in the process. It´s a cmd script file which requires user's input. I tried to generate a TXT file with the settings, and run the script reading the input from that file:
.\config < settings.txt
But it didn´t work. I got that message:
Enter server URL > Enter authentication type (press enter for PAT) > Enter perso
nal access token > Cannot read keys when either application does not have a cons
ole or when console input has been redirected. Try Console.Read.
Is it possible to set up a build agent by script? Is there any way to "redirect" the console input in a such way that this config.cmd
works perfectly?
Upvotes: 4
Views: 2159
Reputation: 1583
Did you try passing --help to the Config.cmd
There are a number of examples below is a snippet of the examples:
Remember to check return code when using unattended configuration
Win : .\config.cmd --unattended --url https://myaccount.visualstudio.com --auth PAT --token <token> --pool default --agent myagent
Unix : ./config.sh --unattended --acceptteeeula --url https://myaccount.visualstudio.com --auth PAT --token <token> --pool default --agent myagent
Win : .\config.cmd --unattended --url http://mylocaltfsserver:8080/tfs --auth Integrated --pool default --agent myagent
Unix : ./config.sh --unattended --acceptteeeula --url http://mylocaltfsserver:8080/tfs --auth Negotiate --username DOMAIN\USER_NAME --password MyPassword --pool default --agent myagent
Upvotes: 6