microsoft/tfs-cli
TypeScript
Captured source
source ↗microsoft/tfs-cli
Description: Cross-platform CLI for Microsoft Team Foundation Server and Visual Studio Team Services
Language: TypeScript
License: MIT
Stars: 384
Forks: 139
Open issues: 145
Created: 2015-07-22T09:23:42Z
Pushed: 2026-06-12T07:00:09Z
Default branch: master
Fork: no
Archived: no
README:
Node CLI for Azure DevOps
> NOTE: If you are looking for the new _Azure DevOps CLI_, see vsts-cli

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 --help
> Help info is dynamically generated, so it should always be the most up-to-date authority.
Command sets
tfx build([builds](docs/builds.md)): Queue, view, and get details for builds.tfx build tasks([build tasks](docs/buildtasks.md)): Create, list, upload and delete build tasks.tfx extension([extensions](docs/extensions.md)): Package, manage, publish _Team Foundation Server_ / _Azure DevOps_ extensions.tfx workitem([work items](docs/workitems.md)): 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 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 successfullyExamples of valid URLs are:
https://marketplace.visualstudio.comhttps://youraccount.visualstudio.com/DefaultCollection
Basic auth
You can also use basic authentication by passing the --auth-type basic parameter (see [Configuring Basic Auth](docs/configureBasicAuth.md) 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 & Verbose Logging
CLI Trace Output
To see detailed tracing output from the CLI, set the TFX_TRACE environment variable and then run commands. This may provide clues to the issue and can be helpful when logging an issue.
Linux/OSX:
export TFX_TRACE=1
Windows:
set TFX_TRACE=1
PowerShell:
$env:TFX_TRACE=1
Debug Output from Tests
To enable detailed debug output for all CLI commands executed during tests, set the DEBUG_CLI_OUTPUT environment variable to true:
Linux/OSX:
export DEBUG_CLI_OUTPUT=true
Windows:
set DEBUG_CLI_OUTPUT=true
PowerShell:
$env:DEBUG_CLI_OUTPUT='true'
This will print detailed command execution logs for every CLI call made by the test suite.
Mock Server Verbose Logging
To enable verbose logging for the integrated mock server (used in server integration tests), set the DEBUG_MOCKSERVER_OUTPUT environment variable to true:
Linux/OSX:
export DEBUG_MOCKSERVER_OUTPUT=true
Windows:
set DEBUG_MOCKSERVER_OUTPUT=true
PowerShell:
$env:DEBUG_MOCKSERVER_OUTPUT='true'
This will print detailed request/response and lifecycle logs from the mock server during test runs.
All three variables (TFX_TRACE, DEBUG_CLI_OUTPUT, DEBUG_MOCKSERVER_OUTPUT) are also available as pipeline variables in the Azure DevOps pipeline and default to false.
Development
Building from Source
To build the project from source:
1. Install dependencies:
npm install
2. Build the main project:
npm run build
This compiles the TypeScript source files in the app/ directory to JavaScript in the _build/ directory using the TypeScript compiler and copies necessary files.
3. Clean build artifacts (optional):
npm run clean
Testing
The project includes comprehensive tests, including server integration tests with an integrated mock server. To run them:
1. Build the project first (required):
npm run build
2. Run all tests:
npm test
This builds the test files and runs all test suites.
3. Run specific test suites:
npm run test:build-commands npm run test:extension-commands npm run test:commandline npm run test:server-integration
4. Run tests with CI reporter:
npm run test:ci
Note: The mock server is now integrated as part of the test suite in the tests/mock-server/ directory and is automatically compiled when running tests. No separate build step is required for the mock server.
Enabling Mock Server Verbose Logging
For debugging server integration tests, you can enable verbose logging for the mock server to see detailed request/response information. This requires modifying the test files temporarily:
1. Locate the test file you want to debug (e.g., tests/server-integration-login.ts)
2. Find the `createMockServer` call in the...
Excerpt shown — open the source for the full document.
Notability
notability 5.0/10New Microsoft tool repo with moderate stars.