对托管的TFS进行身份验证:TF30063:您无权访问.visualstudio.com [英] Authenticating to hosted TFS: TF30063: You are not authorized to access .visualstudio.com
问题描述
我正在尝试通过c#连接到visualstudio.com上的TFS,并遇到身份验证错误
I'm trying to connect to TFS on visualstudio.com through c# and am getting auth errors
TF30063:您无权访问[subdomain] .visualstudio.com.
TF30063: You are not authorized to access [subdomain].visualstudio.com.
这是我尝试输入用户名和密码(确定为100%正确)的方式,我可以通过复制和粘贴u/n&通过,并且该帐户是集合和项目的一部分.
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();
推荐答案
基于visualstudio.com,看起来您正在连接到托管的TFS.
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.
如果您在TFS网页(托管的右上角)中转到个人资料,则有一个凭据选项卡.输入用户名和密码作为备用凭据,您现在可以通过基本身份验证标头发送邮件了.
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.
以C#编程方式为:
NetworkCredential netCred = new NetworkCredential(
"altUserName",
"altPassword");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
Buck在这里发表了关于它的博客:
Buck blogged about it here: