3
votes

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?

1
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/xxxPatrickLu-MSFT
@PatrickLu-MSFT, doesn't work for either of them. Both results the same.mohammad rostami siahgeli
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
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
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: stackoverflow.com/questions/46483801/…PatrickLu-MSFT

1 Answers

3
votes

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