I'm using the Java TFS SDK to connect to on-premise TFS 2012 server. I'm updating it to use a new account to connect to TFS. When I run the code on my local machine it connects without issue. I can use both my personal domain account and a new domain service account.
When I deploy the code to my tomcat server and run it through a web service call, it fails to authenticate using the new service account. It works when I use my personal domain account, but I need it to work for this service account.
com.microsoft.tfs.core.exceptions.TFSUnauthorizedException: Access denied connecting to TFS server http://tfsserver:8080/ (authenticating as MYDOMAIN\xxxxxxx)
Here's how I connecting
TFSTeamProjectCollection tpc;
String tfsURL = "http://tfsserver:8080/tfs/My%20Software%20Development/";
try {
Credentials credentials = new UsernamePasswordCredentials("MYDOMAIN\\" + TFS_USER, TFS_PASSWD);
URI tfsURI = new URI(tfsURL);
tpc = new TFSTeamProjectCollection(tfsURI, credentials);
tpc.ensureAuthenticated();
} catch (Exception ex) {
logger.error("Unable to connect to TFS at " + tfsURL + "; Exception: " + ex.getMessage());
throw ex;
}
Why does only one account work when deployed to server but both accounts work when testing on my local machine?