4

I'm trying to get the list of workspaces using this command:

tf workspaces /collection:url /computer:* /owner:* /format:xml > workspacesxml.xml

Where I replace url with the Azure DevOps URL of my organization account.

The problem is that it complains that:

TF30063: You are not authorized to access

I've Cleared Windows credentials, restarting and trying again and no success. Using /login:username,password is not an option, since I have 2FA enabled.

How do I re-login into command line (CMD) or logout of TF.exe?

  • What kind of url are your using ? TFS url `http://tfsserverurl:8080/tfs` or Azure DevOps Service previous name VSTS url `https://xxxxx.visualstudio.com` or `https://dev.azure.com/xxx` – PatrickLu-MSFT Oct 30 '19 at 10:08
  • @PatrickLu-MSFT, doesn't work for either of them. Both results the same. – mohammad rostami siahgeli Nov 03 '19 at 10:51
  • Hi mohammad rostami siahgeli, have you tired with the PAT token? Unlike using Microsoft email address and password. The sample command looks like `tf workspaces /collection:https://dev.azure.com/patricklu /login:PATtoken` Besides, you could also try to login your azure devops service account from web portal first. It will cache your password in local machine. Then try to use the `tf.exe` command later. – PatrickLu-MSFT Nov 04 '19 at 03:30
  • 1
    no @PatrickLu-MSFT, I didn't try that. I had to do another thing. Shame on Microsoft to have only one tool to get workspaces and it gets stuck logged in. Thanks for your answer and help. I filed a bug to Microsoft developers. – mohammad rostami siahgeli Nov 04 '19 at 08:56
  • Sure, thanks for your quick response. Sorry for any inconvenience. Just share one more info in case you need it. Instead of using tf.exe command, you could also use object API to query workspace on your computer, details please refer my answer in this question: https://stackoverflow.com/questions/46483801/how-to-call-getworkspace-in-tfs-properly – PatrickLu-MSFT Nov 04 '19 at 09:04

1 Answers1

4

Your error is clearly, not authorized to connect remote url. If it's not cached in local, you need to specify the authentication included in the command line.

According to your description the Azure DevOps URL of my organization account. seems you are using Azure DevOps Service, 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 tf.exe on Azure DevOps Service, you need to use PAT token. The command line is:

tf workspaces /collection:https://xxxx.visualstudio.com /login:PATtoken

Add a screenshot:

enter image description here


Details of using Personal access tokens (PATs) which are alternate passwords that you can use to authenticate into Azure DevOps. When use it, just leave the user name empty and enter password with PAT token.

When you are using it, please navigate to https://tfsurl/{teamprojectcollection}/_usersSettings/tokens, and make sure your PAT is still in validity period. If not, please create new token by clicking 'New Token' button.

More details please take a look at our official link-- Authenticate access with personal access tokens

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Your screenshot is not showing a PAT.... Also the command is different from your response... I think you copied that screenshot from another response (https://stackoverflow.com/questions/49868046/how-to-connect-tfs-online-using-pat-or-oaut) – rsc Sep 16 '21 at 22:35