Search code examples
c#tfsazure-devopsnetworkcredentials

Error when trying to connect to Team Foundation Server


I'm trying to connect to our online TFS. This is what I currently have:

NetworkCredential cred = new NetworkCredential(textBox_Username.Text, 
    textBox_password.Password);
Uri TFSurl = new Uri("https://myCompany.visualstudio.com/DefaultCollection");
TfsConfigurationServer tfs = new TfsConfigurationServer(TFSurl, cred);
tfs.EnsureAuthenticated();

This throws me :

TF30063: You are not authorized to access https://actacom.visualstudio.com/DefaultCollection.

The Credentials entered are correct.


Solution

  • Check this blog post, it has a sample code on how to do it. I've tried it with my VSO account and it worked just fine.