Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically connecting to TFS getting "TF30063: You are not authorized" error

I am trying to create a program in c# that allows me to connect to my TFS in order to create new work items.

NetworkCredential netCred = new NetworkCredential(
"username",
"password");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("https://example.visualstudio.com/DefaultCollection"),tfsCred);

tpc.Authenticate();

At the moment when I am trying to make a connection to TFS I am using my own Live username and password which is giving me the error message "TF30063: You are not authorized". I'm not sure on the different ways to make a connection to TFS.

I believe the correct way is using the service credentials, but at the moment I can't workout how to find out the service credentials only I am not sure how to find out my service credentials within TFS.

like image 390
NigelMassey Avatar asked Feb 20 '14 15:02

NigelMassey


1 Answers

You need to enable alternate credentials when connecting to Visual Studio Online with the TFS API.

like image 101
Eric Johnson Avatar answered Nov 19 '22 14:11

Eric Johnson