5

I'm trying to solve this problem since a long time, every execution I perform on TF.exe command, is throwing TF30063 exception, when i'm the admin and the only user of my TFS.

Problem: Try to execute this in a clean machine, without any visual studio user logged in on visual studio, IMPORTANT: also remove your user from windows credentials.

tf.exe workspaces /computer:mycomputer

enter image description here

This modal pops up prompting for credentials, but I need something to be run in a command window without user interference, so checking help I see that you could send /login:user,password

Then, again let's try with that in the command:

tf.exe workspaces /computer:mycomputer /login:[email protected],MyPassword

And now, I get the following exception:

TF30063: You are not authorized to access xxx

BUT, and for the last, if I login on that popup (which I don't want to do because it will be a remote build service) suddenly all commands works fine.

What is the point of having /login command if is not useful here? is there a way to perform this login without prompt?

Thanks for the help!

1
  • I also tried to add in the Windows Certificates, using cmdkey.exe, the acount that is trying to log in, but this was not also useful.
    – Yogurtu
    Commented Feb 7, 2018 at 12:52

2 Answers 2

3

It seems you are using VSTS, not on-premises TFS. Usually /login option can be used on on-premises TFS, we use the /login option to specify the Team Foundation Server user account to run a command.

If you want to use on VSTS, you need to get a OAuth token, and specify /loginType:OAuth. The command line is:

tf workspaces /collection:https://xxxx.visualstudio.com /loginType:OAuth /login:.,[OAuth token]

Add a screenshot:

enter image description here

11
  • Indeed, i´m using VSTS, I was not aware of this difference, but I see your point, probably the command that I ran will work if I have a on-premise TFS. But anyway, do you know how could I authenticate to my VSTS by command line?
    – Yogurtu
    Commented Feb 7, 2018 at 12:52
  • You need to get a OAuth token by following this article, specify /loginType:OAuth and use the OAuth token as password in the command line: tf workspaces /collection:https://xxxx.visualstudio.com /loginType:OAuth /login:.,**** Commented Feb 8, 2018 at 5:33
  • Or set up a PAT if you don’t want to use OAuth. Commented Feb 8, 2018 at 8:03
  • This looks promising, I will give a try and get back to mark as answer if it works. Thanks!
    – Yogurtu
    Commented Feb 11, 2018 at 22:19
  • 4
    The instructions for getting an OAuth token (in the OAuthWebSample) require deploying an app to Azure Web Apps. Isn't there a better way to get a token? I find it unreasonable to have to deploy a web app to public hosting to get the token I need to authenticate a command-line tool to pull from source control (as well as quite impractical given the approvals I'd need do it).
    – user221592
    Commented Jan 13, 2020 at 22:47
0

I know it's been very long since this thread is opened but I recently experienced the same issue and resolved it by following the below steps. This maybe helpful for people who will get stuck with this issue in future...

Yes, I have faced the same issue and was able to resolve the issue finally :)

The problem is that tf.exe command with the switch "/login:username,password" works as expected with the onprem versions, however you have to use OAuth for saas version. Please find the below example command for saas version for your reference.

tf workspaces /collection:https://dev.azure.com/OrganizationName /loginType:OAuth /login:.,OAuthtoken

To generate the OAuth token you should be using the following article as a reference.

https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/oauth?view=azure-devops

Hope this helps someone at some point of time :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.