Use the TFS Cross Platform Command Line with TFS using basic authentication

Last Update: 3/10/2017

What you'll need

  • The latest version of node, which can be downloaded here
  • TFS Cross Platform Command Line Interface (tfx)
    • tfx can be installed using npm, a component of Node.js by running: no-highlight npm i -g tfx-cli

To find out more about the tfx CLI, check out the tfx documentation in GitHub.

Configure TFS to use Basic Authentication

WARNING

Basic authentication sends usernames and passwords in plaintext. You should consider configuring TFS to use SSL in order to enable secure communication when using basic auth.

Follow these steps to enable basic auth for your TFS:

  1. Install the Basic Authentication feature for IIS in Server Manager
  2. Open IIS Manager and expand to the Team Foundation Server website, double click the Authentication tile in the Features view.

  3. Click on Basic Authentication in the list of authentication methods. Click Enable in the right hand column. You should now see Basic Authentication enabled.

NOTE

Leave the domain and realm settings for Basic Authentication empty.

tfx login with Basic Authentication

Now you can start to use tfx against your TFS server. You'll want to login before issuing commands.

  1. Type the following login command:

    tfx login --auth-type basic
    
  2. You will be prompted to add your service url.

  3. You will be prompted for your username. Use domain\user (e.g. fabrikam\peter). If you are working on a workgroup machine, use machinename\user.
  4. You will be prompted for your password. Enter the password for the username you entered.

You can now use any other tfx command.

> tfx login --auth-type basic
Copyright Microsoft Corporation

Enter service url > http://localhost:8080/tfs/defaultcollection
Enter username > fabfiber\peter
Enter password > *******
logged in successfully