c# - 验证托管 TFS : TF30063: You are not authorized to access . visualstudio.com

标签 c# .net tfs azure-devops tfs-sdk

我正在尝试通过 C# 连接到 visualstudio.com 上的 TFS,但出现身份验证错误

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

这是我尝试输入用户名和密码的方式,它们 100% 肯定正确,我可以通过复制和粘贴 u/n & pass 通过网站登录,并且该帐户是收藏和项目。

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

最佳答案

根据 visualstudio.com,您似乎正在连接到托管 TFS。

您可以启用备用凭据,然后使用这些凭据通过基本身份验证进行身份验证。

如果您转到 TFS 网页中的个人资料(托管的右上角),则会有一个凭据选项卡。输入备用凭据的用户名和密码,您现在可以通过基本身份验证 header 发送。

在 C# 中以编程方式是:

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

Buck 在这里发表了博客:

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

关于c# - 验证托管 TFS : TF30063: You are not authorized to access . visualstudio.com,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17331955/

相关文章:

tfs - 看板是否可用于 Visual Studio 2010 和 TFS 2010

visual-studio-2012 - 为什么 TFS 内部版本号在 2012 年停止自动递增?

angular - Angular 2 应用程序的 TFS 构建失败(TypeScript 错误),但在本地构建一切正常

c# - 使用 BinaryFormatter 时可以将属性标记为 "not to be serialized"吗?

c# - ConnectionStrings 或 AppSettings 的存储库

c# - 以最快的方式从有条件的列表中删除

C# 重新加载系统环境变量

c# - 为什么我可以通过索引访问 KeyCollection/ValueCollection 中的项目,即使它没有实现 IList(Of Key)?

c# - 特性的最佳命名?

c# - .NET 中的 xslt:param 数组