Friday, October 12, 2012

TFS30063–You are not authorized to access

 

Recently I received this complaint from someone, who was trying to connect to TFS using TFS client API.

Here is the code that my friend was using

NetworkCredential networkCredential = new NetworkCredential("guruholla", "******", "MyDomain");



Uri uri = new Uri("http://mytfsserver:8080/tfs");



TeamFoundationServer teamFoundationServer =  new TeamFoundationServer(uri.AbsoluteUri, networkCredential);



Console.Write("Connecting to Team Foundation Server {0}...", uri.ToString());



teamFoundationServer.Authenticate();



Console.Read();




After which I realized that, he did not have access to the default collection in TFS and he had only access to one of the collection. Changing the URL to directly point to the collection helped.





Uri uri = new Uri("http://mytfsserver:8080/tfs/birdCollection");



     




Moral of the story: See if you have access to default collection.