Authenticating to hosted TFS: TF30063: You are not authorized to access .visualstudio.com

99封情书 提交于 2019-12-07 18:00:20

问题


I'm trying to connect to TFS on visualstudio.com through c# and am getting auth errors

TF30063: You are not authorized to access [subdomain].visualstudio.com.

Here is how I'm trying to enter the username and the password, which are 100% for sure correct, I can login through the website by copying and pasting the u/n & pass, and the account is part of the collection and projects.

var tfsServer = TfsConfigurationServerFactory.GetConfigurationServer(new Uri(server));
tfsServer.Credentials = new NetworkCredential(username, password);
tfsServer.Authenticate();

回答1:


Based on visualstudio.com, it looks like you're connecting to hosted TFS.

You can enable alternate credentials and then use those credentials to auth via basic auth.

If you go to your profile in the web page for TFS (upper right hand corner in hosted), there's a credentials tab. enter a username and password for alternate credentials and you can now send via basic auth header.

Programmatically in C# it's:

NetworkCredential netCred = new NetworkCredential(
            "altUserName",
            "altPassword");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);

Buck blogged about it here:

http://blogs.msdn.com/b/buckh/archive/2013/01/07/how-to-connect-to-tf-service-without-a-prompt-for-liveid-credentials.aspx




回答2:


If you are using Windows Service to connect TFS, then Log on it with administrator credential or a credential which have access to the TFS.

right click on Windows Service -> Properties -> Navigate Log on Tab -> Select This Account and give username and password..

It is worked for me hope it helps



来源:https://stackoverflow.com/questions/17331955/authenticating-to-hosted-tfs-tf30063-you-are-not-authorized-to-access-visuals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!