Search code examples
visual-studiotfsazure-devopsridertee

How to resolve Tee clc authorization error


I am trying to run tf wrokspaces command for my existing workspace, so I can use it in jetbrains rider as suggested below Jetbrains Rider Article

When I run the command I always get below error,

"TF31003: Either you have not entered the necessary credentials or your user account does not have permission to connect to the Team Foundation Server at https://tfs.app.visualstudio.com/. Ask your server administrator to add the appropriate permissions to your account.

TF400813: The user 'Windows Live ID\xxxxxxxxxx' is not authorized to access this resource.
com.microsoft.tfs.core.exceptions.TFSAccessException: You do not have permission to access the server."

I have all the necessary permission(i.e. Administrator) on tfs server to run tf workspaces command. 

In the log file of tee clc,

"2020-09-10 16:14:13,252 INFO  [main] (com.microsoft.tfs.core.telemetry.TfsTelemetryHelper) Command Line Client v.14.134.0.201804261732
2020-09-10 16:14:13,252 INFO  [main] (com.microsoft.tfs.core.telemetry.TfsTelemetryHelper) AppInsights telemetry initialized
2020-09-10 16:14:13,252 INFO  [main] (com.microsoft.tfs.core.telemetry.TfsTelemetryHelper)     Developer Mode: false
2020-09-10 16:14:13,252 INFO  [main] (com.microsoft.tfs.core.telemetry.TfsTelemetryHelper)     Production Environment: true
2020-09-10 16:14:13,425 INFO  [main] (com.microsoft.alm.provider.UserPasswordCredentialProvider) Getting credential that works for uri: https://xxxxx.visualstudio.com/
2020-09-10 16:14:13,425 INFO  [main] (com.microsoft.alm.provider.UserPasswordCredentialProvider) Getting credential based on OAuth2 token
2020-09-10 16:14:13,426 INFO  [main] (com.microsoft.alm.auth.oauth.OAuth2Authenticator) Ready to launch browser flow to retrieve oauth2 token.
2020-09-10 16:14:13,426 INFO  [main] (com.microsoft.alm.auth.oauth.OAuth2Authenticator) Attempt to use oauth2-useragent provider: JavaFx
2020-09-10 16:14:13,427 INFO  [main] (com.microsoft.alm.auth.oauth.OAuth2Authenticator) Using oauth2-useragent providers to retrieve AAD token.
2020-09-10 16:14:52,003 INFO  [main] (com.microsoft.alm.provider.UserPasswordCredentialProvider) Username exist? true, password exists? true
2020-09-10 16:14:52,089 INFO  [main] (com.microsoft.tfs.core.config.httpclient.DefaultHTTPClientFactory) HttpClient configured for https://xxxxxx.visualstudio.com/, authenticating as OAuth2
2020-09-10 16:14:53,186 WARN  [main] (com.microsoft.tfs.core.httpclient.HttpMethodDirector) Unable to respond to any of these challenges: {bearer=Bearer authorization_uri=https://login.microsoftonline.com/12fb99fd-4c12-44fb-b3ce-a12ca5aadf63, tfs-federated=TFS-Federated}
2020-09-10 16:14:53,929 WARN  [main] (com.microsoft.tfs.core.TFSTeamProjectCollection) Error getting data provider
com.microsoft.tfs.core.exceptions.TFSAccessException: You do not have permission to access the server.

TF31003: Either you have not entered the necessary credentials or your user account does not have permission to connect to the Team Foundation Server at https://tfs.app.visualstudio.com/. Ask your server administrator to add the appropriate permissions to your account.

TF400813: The user 'Windows Live ID\xxxxx' is not authorized to access this resource.
    at com.microsoft.tfs.core.exceptions.mappers.TECoreExceptionMapper.map(TECoreExceptionMapper.java:84)
    at com.microsoft.tfs.core.exceptions.mappers.RegistrationExceptionMapper.map(RegistrationExceptionMapper.java:18)
    at com.microsoft.tfs.core.clients.registration.RegistrationData.newFromServer(RegistrationData.java:61)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationData(RegistrationClient.java:617)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationEntries(RegistrationClient.java:144)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationEntries(RegistrationClient.java:129)
    at com.microsoft.tfs.core.PreFrameworkServerDataProvider.findServiceLocation(PreFrameworkServerDataProvider.java:275)
    at com.microsoft.tfs.core.PreFrameworkServerDataProvider.locationForCurrentConnection(PreFrameworkServerDataProvider.java:251)
    at com.microsoft.tfs.core.TFSTeamProjectCollection.getServerDataProvider(TFSTeamProjectCollection.java:172)
    at com.microsoft.tfs.core.TFSConnection.getWebService(TFSConnection.java:903)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory$7.newClient(DefaultClientFactory.java:208)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory.newClient(DefaultClientFactory.java:86)
    at com.microsoft.tfs.core.TFSConnection.getClient(TFSConnection.java:1490)
    at com.microsoft.tfs.core.TFSTeamProjectCollection.getVersionControlClient(TFSTeamProjectCollection.java:376)
    at com.microsoft.tfs.client.clc.vc.commands.CommandWorkspaces.displayAndUpdate(CommandWorkspaces.java:295)
    at com.microsoft.tfs.client.clc.vc.commands.CommandWorkspaces.run(CommandWorkspaces.java:93)
    at com.microsoft.tfs.client.clc.Application.run(Application.java:306)
    at com.microsoft.tfs.client.clc.Application.run(Application.java:154)
    at com.microsoft.tfs.client.clc.vc.Main.main(Main.java:55)
2020-09-10 16:14:53,932 ERROR [main] (com.microsoft.tfs.client.clc.Application) An error occurred: You do not have permission to access the server.

TF31003: Either you have not entered the necessary credentials or your user account does not have permission to connect to the Team Foundation Server at https://tfs.app.visualstudio.com/. Ask your server administrator to add the appropriate permissions to your account.

TF400813: The user 'Windows Live ID\xxxxxxxx' is not authorized to access this resource.
com.microsoft.tfs.core.exceptions.TFSAccessException: You do not have permission to access the server.

TF31003: Either you have not entered the necessary credentials or your user account does not have permission to connect to the Team Foundation Server at https://tfs.app.visualstudio.com/. Ask your server administrator to add the appropriate permissions to your account.

TF400813: The user 'Windows Live ID\xxxxxxxx' is not authorized to access this resource.
    at com.microsoft.tfs.core.exceptions.mappers.TECoreExceptionMapper.map(TECoreExceptionMapper.java:84)
    at com.microsoft.tfs.core.exceptions.mappers.RegistrationExceptionMapper.map(RegistrationExceptionMapper.java:18)
    at com.microsoft.tfs.core.clients.registration.RegistrationData.newFromServer(RegistrationData.java:61)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationData(RegistrationClient.java:617)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationEntries(RegistrationClient.java:144)
    at com.microsoft.tfs.core.clients.registration.RegistrationClient.getRegistrationEntries(RegistrationClient.java:129)
    at com.microsoft.tfs.core.PreFrameworkServerDataProvider.findServiceLocation(PreFrameworkServerDataProvider.java:275)
    at com.microsoft.tfs.core.PreFrameworkServerDataProvider.locationForCurrentConnection(PreFrameworkServerDataProvider.java:251)
    at com.microsoft.tfs.core.TFSTeamProjectCollection.getServerDataProvider(TFSTeamProjectCollection.java:172)
    at com.microsoft.tfs.core.TFSConnection.getWebService(TFSConnection.java:903)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory$7.newClient(DefaultClientFactory.java:208)
    at com.microsoft.tfs.core.config.client.DefaultClientFactory.newClient(DefaultClientFactory.java:86)
    at com.microsoft.tfs.core.TFSConnection.getClient(TFSConnection.java:1490)
    at com.microsoft.tfs.core.TFSTeamProjectCollection.getVersionControlClient(TFSTeamProjectCollection.java:376)
    at com.microsoft.tfs.client.clc.vc.commands.CommandWorkspaces.displayAndUpdate(CommandWorkspaces.java:295)
    at com.microsoft.tfs.client.clc.vc.commands.CommandWorkspaces.run(CommandWorkspaces.java:93)
    at com.microsoft.tfs.client.clc.Application.run(Application.java:306)
    at com.microsoft.tfs.client.clc.Application.run(Application.java:154)
    at com.microsoft.tfs.client.clc.vc.Main.main(Main.java:55)
2020-09-10 16:14:53,933 INFO  [main] (com.microsoft.tfs.client.clc.vc.Main) Shutting down
2020-09-10 16:14:53,934 INFO  [main] (com.microsoft.tfs.client.clc.vc.Main) Has shut down"

To verify the tee clc is installed and working properly, I created the new organization and run the same workspaces command. It works well with new organization. Also from visual studio I am able to use my existing workspace without any problem.

Can you please help how to resolve the authorization problem?

Thanks!


Solution

  • To narrow down the issue, please check the following items:

    1. Check the whether your organization backed in AAD, the login account is Windows Live ID\xxxxx or AAD\xxxxx.

    2. Close all Visual Studio instances, delete %LOCALAPPDATA%\.IdentityService, and clear DevOps caches %LOCALAPPDATA%\Microsoft\Team Foundation\x.0\Cache.

    3. Create a new workspace for this organization/Project to see how's the result.