Welcome to EMC Consulting Blogs Sign in | Join | Help

James Dawson's Blog (2005 - 2011)

I have now left EMC Consulting, if you wish to continue to receive new content then please subscribe to my new blog here: http://www.readsource.co.uk

TFS, Build Servers and Un-Trusted Domains

I’ve been meaning to write this up for a while now, and a recent Twitter exchange with @thiago_bagua prompted me to finally get around to it.  This post will describe a way of getting a TFS 2008 build server up and running in an Active Directory domain that has no trust relationship with its associated TFS server.

CAVEAT: Whilst the approach I going to describe below worked for me, your mileage may vary and I doubt that it is an officially supported configuration.

 

Assumptions:

  • You have a working instance of TFS
  • You have already installed the TFS Build Agent (aka Team Build) on your build server

 

The diagram below illustrates the basic scenario, with the TFS Application-Tier (AT) and TFS Build Agent residing in separate domains with no trust relationships.

image

 

With the above configuration there are basically two problems we need to overcome:

  • The Build Agent that runs as a Windows service called ‘Visual Studio Team Foundation Build’, will need to authenticate with the TFS AT in order to consume the various web services (e.g. source control, work item tracking, publishing build results etc.)
  • The TFS AT will need to authenticate with the Build Agent service in order to be allowed to start a build

 

Build Agent to TFS Authentication

Solving the first problem involves storing a saved password in the profile of the Build Agent’s service account, in this scenario ‘DOMAINB\TFSBuild’, and ensuring that the server will use that credential automatically.

1) Log onto the Build Agent server as the ‘DOMAINB\TFSBuild’ user (or equivalent)
2) Open the ‘User Accounts’ Control Panel applet (also called ‘Stored User Names and Passwords’ on Windows Server 2003)
3)

Select ‘Manage your network passwords’

 image

4) Add an entry for the server running the TFS Application Tier (you may want to add two, one for the server’s NetBIOS name and another for the server’s FQDN).
image

The username you enter here needs to be an account in the ‘DOMAINA’ domain that is a member of the ‘Build Services’ application group in the Team Project(s) the Build Agent will be servicing.
 image

Here you can see both the NetBIOS and FQDN entries for the TFS server have been added.
image
5) Review the Internet Explorer security settings of the ‘Local Intranet Zone’ and ensure that the ‘Automatic logon only in Intranet zone’ is selected.
 image
image
6) By default the FQDN of the TFS Application Tier is unlikely to be treated as being in the Intranet Zone, so we need to add it explicitly.
image
image
7) You should now be able to test these changes by opening Team Explorer and verifying that you are able to transparently connect to the TFS server (i.e. you aren’t prompted to enter credentials).

 

TFS-to-Build Agent Authentication

Having completed the above, we now just need to solve the second problem.  My approach was to create a local account on the Build Agent with the same username and password as the account used as the identity of the ‘Microsoft Team Foundation Server Application Pool’ on the TFS Application Tier.  This has the effect of allowing the TFS Application Tier to authenticate to the build server using it credentials.

As an alternative to this, you could setup a saved password, this time on the TFS server, in the profile of the ‘DOMAINA\TFSService’ account for the build agent server that use a domain account in ‘DOMAINB’ or local account on the build server.

 

At this point you should be able to register the new build agent in your Team Project and queue a build to it.

 

Troubleshooting

If you have hit problems whilst trying the queue the build, then this indicates that the TFS Application Tier had a problem connecting to the build agent.  This is typically caused by TFS not being able to authenticate to the build agent or some kind of firewalling preventing the network connection, usually via TCP port 9191.

If the build starts but quickly fails, then this generally points to either or both of the following:

  1. The Build Agent service account cannot authenticate to the TFS Application Tier (i.e. a problem with its saved username/password).
  2. The saved username/password has not been added to the ‘Build Services’ application group in the relevant Team Project.

 

Anyway, if you find yourself in this sort of edge case scenario then hopefully the steps detailed here will be helpful.  I'm now wondering whether a similar approach could be used to workaround the issue of not being able to add users, from a Trusting domain, to TFS application groups when there isn't a 2-way trust in place...?

 

Published 12 June 2009 02:13 by james.dawson

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Venu said:

Hay James,

I have used your concept of creating local users with the same user id & Pwd to connect for configuring a build server in two different domains.

But iam not able to figure out this issue authentication is not happening at the build server end so request you to help me out on this issue.

Regards

Venu

April 4, 2012 13:57
 

Andrew said:

First off - this is a great post - thank you for the information.

Venu - we had an issue with local users also - we ended up making a domain user on both sides and using the credential store to map them as described above.

The one trick that we needed to do at the end was to go directly into the windows services list on the build server and change the build serviceto run under the domain account for that domain.  When we tried to make that change within the TFS admin console, it wouldn't let us save the changes, as it was having a connection issue.

After that it worked like a charm.

June 1, 2012 14:26

Leave a Comment

(required) 
(optional)
(required) 
Submit
Powered by Community Server (Personal Edition), by Telligent Systems