TF.exe - authentication

Copper Contributor

I am trying to automate TFS source control operations using TF.exe.

 

The page below says I can authenticate either with actual credentials or with a personal access token.

 

Use Team Foundation version control commands - Azure Repos | Microsoft Learn

 

However, this doesn't work with a basic test that attempts to list workspaces with either of the commands below:

 

TF.exe workspaces /collection:PROJECT_COLLECTION_URL /login:USERNAME,PASSWORD /noprompt

 

TF.exe workspaces /collection:PROJECT_COLLECTION_URL /login:PERSONAL_ACCESS_TOKEN /noprompt

 

I have also tried the format below after finding an article suggesting it:

 

TF.exe workspaces /collection:PROJECT_COLLECTION_URL /login:.,PERSONAL_ACCESS_TOKEN /noprompt

 

Still no joy.

 

The username and password I am using are definitely correct because I have tested them without /noprompt and copied and pasted them exactly.  I am 100% sure this is not a case of incorrect username/password.

 

The PAT I am using is a known working PAT that is definitely full access and active.  I am running code with it using both the old client libraries (for a variety of source control operations) and the new REST client libraries (for work item queries).

 

I cannot get the the "workspaces" command to execute with either credentials or a PAT.  What is the deal here?  Is the page above correct or not?  Does it just not work for some commands?

My ultimate goal is to be able to use TF.exe to create workspaces, run gets and check in/out automatically with no prompts.  Is this possible or not?

 

2 Replies

Did you make any progress on this? I have ran into the same problem when I'm connecting to the TFVC Project hosted in Azure DevOps.
for the PROJECT_COLLECTION_URL I tried both old and new format https://OrgXyz.visualstudio.com/ & https://dev.azure.com/OrgXyz 

The /login: section, in addition to the example in your question I also have tried the combination of 

/login:USERNAME,BASE64(PersonalAccessToken)
/login:.,BASE64_PAT
/login:USERNAME,BASE64(":"+PersonalAccessToken)
/login:.,BASE64(":"+PersonalAccessToken)

 

my user name is email.


@JMILNE1940 

@ZhaoZongxi  @JMILNE1940   Did you come up with any solution for this