1
votes

I developed a simple app to do some custom things for our company view the TFS SDK. I was able to get this working for myself locally, but when I deploy the site to a web server I get a not authorized error: TF30063: You are not authorized to access xxx

This only works locally for me if I am signed into the Team Project from Visual Studio 2012 and running locally from there. Anyone have thoughts on why I can't get this to work when I deploy to another server? Here is the code... Fails at EnsureAuthenticated() (I have also tried the 'Authenticated()' method).

var netCred = new NetworkCredential("username", "password", "domain");

var basCred = new BasicAuthCredential(netCred);

var tfsCred = new TfsClientCredentials(basCred);

tfsCred.AllowInteractive = false;

tfs = new TfsConfigurationServer(new Uri("https://tfsurl"), tfsCred);

tfs.EnsureAuthenticated();
1

1 Answers

0
votes

If you are connecting to a TFS server on your domain then you can use NetworkCredential to authenticate:

Uri uri = new Uri("http://vsalm:8080/tfs");
ICredentials credentials = new NetworkCredential("User", "Password");

using (TfsConfigurationServer server = new TfsConfigurationServer(uri, credentials))
{
   server.EnsureAuthenticated();
}

If you are connecting to the hosted Team Foundation Service then you may need to enable alternate credentials.