Configure TFS Express 2012 To Use Existing SQL Server Instance

Update 2013-01-09 <Start>
One should not go this way. When I tried to install TFS Express Update 1, the update failed because it requires TFS Express to run on a SQL Express instance.
So – in case you want to keep your installation up to date – do not use this hack!
Update 2013-01-09 <End>

When I installed TFS Express 2012, I was surprised that I could not choose the SQL Server instance to use during setup. Instead, the TFS Express installation put a SQL Express on my machine without asking. Even though a SQL 2012 instance was already installed 🙁

Well, since I did not want to have two SQL Server instances running on my machine – what a waste of resources – I re-configured the TFS to run on the SQL 2012 instance. There were only a few steps to take after the successful TFS Express installation:

– Detach the databases Tfs_Configuration and Tfs_DefaultCollection from the SQL Express instance. Maybe you have to kill some processes that are currently using these databases, using the activity monitor.

– Copy the files of these two databases into your preferred database file directory.

– Attach the copied(!) files to your primary SQL Server instance.

– Re-attach the original files to the SQL Express instance.

– Add the missing roles to the master database; compare the roles with SQL Express

– Add the missing security settings (user mappings) of the NT Authority\Local Service for Tfs_Configuration and Tfs_DefaultCollection; compare the settings with SQL Express

– Open the web.config located in Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services and change the connection string applicationDatabase in the appSettings section (no, it is not located inside of the connectionStrings section!).

– Change the DisplayName to the name of your SQL Server instance (default: (local)) in the table tbl_CatalogResource of the Tfs_Configuration database, where the current value is SQLEXPRESS.

– Reboot your machine.

– Stop the SQL Express instance and change its start type to manual or disabled

– Use the TFS Admin Console to check whether the changes were successful

WARNING: This only works as long as you are do not need to create a new Team Project Collection. Creating a new collection in this scenario leads to an error telling that TFS Express requires a SQL Express (beside other errors telling that (local) is not a valid server name, which can be fixed easily). So as long as you are happy with a single collection (the DefaultCollection), this hack should work. Otherwise, you have to run the SQL Express instance beside your full featured SQL Server instance. Sad thing!