microsoft / tfs-cli

Cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services
MIT License
372 stars 132 forks source link

Node CLI for Azure DevOps

NOTE: If you are looking for the new Azure DevOps CLI, see vsts-cli

NPM version

This is a command-line utility for interacting with Microsoft Team Foundation Server and Azure DevOps Services (formerly VSTS). It is cross platform and supported on Windows, MacOS, and Linux.

Setup

First, download and install Node.js 4.0.x or later and npm (included with the installer)

Linux/OSX

sudo npm install -g tfx-cli

Windows

npm install -g tfx-cli

Commands

To see the 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

Login

To avoid providing credentials with every command, you can login once. Currently supported credential types: Personal Access Tokens and basic authentication credentials.

NTLM support is under consideration

Warning! Using this feature will store your login credentials on disk in plain text.

To skip certificate validation connecting to on-prem Azure DevOps Server use the --skip-cert-validation parameter.

Personal access token

Start by creating a Personal Access Token and paste it into the login command.

~$ tfx login
Copyright Microsoft Corporation

> Service URL: {url}
> Personal access token: xxxxxxxxxxxx
Logged in successfully

Examples of valid URLs are:

Basic auth

You can also use basic authentication by passing the --auth-type basic parameter (see Configuring Basic Auth for details).

Settings cache

To avoid providing options with every command, you can save them to a settings file by adding the --save flag.

~$ tfx build list --project MyProject --definition-name println --top 5 --save

...

id              : 1
definition name : TestDefinition
requested by    : Teddy Ward
status          : NotStarted
queue time      : Fri Aug 21 2015 15:07:49 GMT-0400 (Eastern Daylight Time)

~$ tfx build list
Copyright Microsoft Corporation

...

id              : 1
definition name : TestDefinition
requested by    : Teddy Ward
status          : NotStarted
queue time      : Fri Aug 21 2015 15:07:49 GMT-0400 (Eastern Daylight Time)

If you used --save to set a default value for an option, you may need to override it by explicitly providing a different value. You can clear any saved settings by running tfx reset.

Troubleshooting

To see detailed tracing output, set a value for the TFX_TRACE environment variable and then run commands. This may provide clues to the issue and can be helpful when logging an issue.

Troubleshooting on Linux/OSX

export TFX_TRACE=1

Troubleshooting on Windows

set TFX_TRACE=1

PowerShell

$env:TFX_TRACE=1

Contributing

We accept contributions and fixes via Pull Requests. Please read the Contributions guide for more 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.