Use the TFS Cross Platform Command Line with TFS using basic authentication or personal access tokens (PATs)


Basic authentication is not recommended. Turning on IIS basic authentication causes various issues, and you should use personal access tokens (PATs) instead. For example, if you turn on IIS basic authentication, GIT command line will stop working.

If you know you want IIS basic authentication, then 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


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.


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