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

1

6

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.

Welldressed answered 20/2, 2014 at 15:7 Comment(0)
D
4

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

Duster answered 20/2, 2014 at 16:13 Comment(1)
Yes, this is exactly what I needed. I wasn't sure where to find the alternate credentials. Thanks!Welldressed

© 2022 - 2024 — McMap. All rights reserved.