Node CLI for Azure DevOps
NOTE: If you are looking for the new Azure DevOps CLI, see vsts-cli
Internal Deploy / Pull Request validation
Command utility for interacting with Microsoft Team Foundation Server and Azure DevOps Services (formerly VSTS). It is cross platform and supported on Windows, OS X, and Linux.
Setup
First, download and install Node.js 7.0.x or later and NPM (included with the installer or from sources)
Linux/OSX
sudo -E npm install -g tfx-cli
Windows
npm install -g tfx-cli
Commands
To see a list of commands:
tfx
For help with an individual command:
tfx <command> --help
Help info is dynamically generated, so it should always be the most up-to-date authority.
Command sets
tfx build
(builds): Queue, view, and get details for buildstfx build tasks
(build tasks): Create, list, upload and delete build taskstfx build definition
(build definition/definitions): Create, manage, show, list, export, upload and delete build definitionstfx extension
(extensions): Package, manage, publisher Team Foundation Server / Azure DevOps extensionstfx workitem
(work items): Create, query and view work items.
Login
To avoid providing credentials with every command, you can login once. Currently supported credential types: Personal Access Tokens and basic auth credentials.
NTLM support is under consideration
Warning! Using this feature will store your login credentials on disk in plain text.
Personal access token
Start by creating a personal access token and paste it into the login command.
~$ tfx loginCopyright Microsoft Corporation > Service URL: {url}> Personal access token: xxxxxxxxxxxxLogged in successfully
Examples of valid URLs are:
https://marketplace.visualstudio.com
https://youraccount.visualstudio.com/DefaultCollection
Basic auth
You can alternatively use basic auth by passing --auth-type basic
(see Configuring Basic Auth).
Settings cache
To avoid providing other options in every command, you can save options out to a settings file by adding the --save
flag.
~$ tfx build list --project MyProject --definition-name println --top 5 --save ... id : 1definition name : TestDefinitionrequested by : Teddy Wardstatus : NotStartedqueue time : Fri Aug 21 2015 15:07:49 GMT-0400 ~$ tfx build listCopyright Microsoft Corporation ... id : 1definition name : TestDefinitionrequested by : Teddy Wardstatus : NotStartedqueue time : Fri Aug 21 2015 15:07:49 GMT-0400
If you used --save
to set a default value for an option, you may need to override it by explicitly providing the option with a different value. You can clear any saved settings by running tfx reset
.
Troubleshooting
To see detailed tracing output, you can set a value for the TFX_TRACE
environment value and then run commands. That may offer a clue into the problem (and will certainly help if logging an issue).
Linux/OSX
export TFX_TRACE=1
Windows
set TFX_TRACE=1
PowerShell
$env:TFX_TRACE=1
Contributing
We take contributions and fixes via Pull Request. Read here for the details.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Manual installation (from sources)
- refer to installation for your OS (and follow the installation steps).
- clone the repository.
- to compile the sources run (see additional node modules):
npm updatenpm run build `(from the repository root)`
link the executable (and make executable)
Linux (bash)
sudo ln -s <repository root>\app.js /usr/bin/tfxsudo chmod 755 /usr/bin/tfx
windows
replace the content of %appdata%\npm\tfx.cmd
with the following:
@IF EXIST "%~dp0\node.exe" ELSE
additional node modules
run "npm outdated / update" to resolve modules dependecy or install the following modules (this may need to happen befor compilation)
npm install archiver colors graceful-fs gulp-filter gulp-mocha gulp-tsb gulp-util is-utf8 pug jszip node-uuid prompt q readable-stream ts-promise typescript unique-stream user-home validator azure-devops-node-api xml2js del os-homedir copy-paste shelljs lodash minimatch@3.0.2 pretty-hrtime liftoff tildify interpret v8flags minimist onecolor winreg glob json-in-place mkdirp