Tuesday 26 January 2010

Migrating Team Foundation Server 2010 Beta 2 to new servers

Disclaimer : It worked for me, and I hope it works for you, but do so at your own peril. Make sure everything is backed up and I’d suggest testing on a spare machine first before doing it for real.

We’ve been looking at changing our infrastructure at work and moving from VMWare for our virtual servers to using Windows Server 2008 and Hyper-V. The main server which needed to be moved/converted/migrated between the two different virtualisation technologies was the TFS Server; and hence my domain.

I started off by trying to convert the vmdk file to a vhd file which seemed to work well and could be mounted and the data on it read. However; I was unable to boot from it. After spending, way, too much time trying to get it working I decided to look at the migration exercise. And to be honest it was essentially a disaster recovery exercise as we’d have to go through the same steps if it all went wrong so the time wasn’t wasted.

So after doing a test run on a spare virtual machine we had before the server was taken down I fired up the install for SQL Express and started on the path to setting up TFS. After doing some Googling, and finding loads of different articles which seemed to do bits but not all of it I thought I’d post my findings to hopefully help someone in the future. These are the steps which I came up with. I have also now deployed TFS into the new virtualised production system and it seems to work fine (not got automated builds working yet tho).

Here we go:

  1. Backup databases from old TFS. This includes the Tfs_Configuration databases and any project collection databases.
  2. Build/patch new VM with Windows Server (or other OS)
  3. Install SQL Express 2008 with tools
  4. Restore databases, with the same names, into your new SQL Server instance
  5. Install Team Foundation Server 2010 Beta 2 (and reboot when required)
  6. Run the following command – making sure that you have the correct details in the right places

    c:\Program Files\Microsoft Team Foundation Server 2010\Tools>tfsconfig accounts /add /accountType:applicationTier /account:"NT Authority\Network Service" /sqlInstance:.\SqlExpress /databasename:tfs_configuration
  7. Create a local user named after the server name. So for example if your server is called “TFS” then create a local user called “TFS$” (without quotes)
  8. Fire up the Team Foundation Server admin, go to configure installed components and run the Application Tier only upgrade wizard
  9. Once in the wizard point it to the SQL instance locally and it should find the configuration database, select it and continue.
  10. Finish the wizard and it should be pretty happy. Next thing to do is update the server urls on the main server details page to point to the new server name (as it’ll have the old server name in it)
  11. Start up the project collection(s) and throw in a server restart for good measure.
  12. Done!

You should now be able to connect to the server through Visual Studio as before. You will need to add in the new server details (and remove the old). I found all the workspaces where fine and all was good to go.

With a big team its probably wise to get everyone to shelve all their changes over a weekend or evening and make sure nothing is checked out. But this is down to preference and may need to be tested.

Hope this helps someone in the future :-)

2 comments:

Unknown said...

Hi,
i was trying to recover tfs from backed-up databases (on to a new server), but it failed at the tfsconfig command step with the follwing error:
Unable to find any compatible SQL Analysis Services database within the specified instance.

Unfortunately i dont have the analysis database from the old server. Could you please tell me how to rectify this issue.
cheers,

Lasa

Adam Storr said...

@lasa - Thanks for your comment.

As I have only tried this in the "basic" configuration I am unable to fully comment.

However, what I would try though personally would be to install SQL 2008 with Analysis services on the server so it was all setup (check once its done), then recreate the tfs databases and restore and then run the tfsconfig command. This could all be done on a virtual machine or a server you don't mind rebuilding to test on before deploying to production.

Also check out Brian Krieger's blog at http://blogs.msdn.com/bkrieger/default.aspx He was very helpful to me when I had a TFS query.

Hope this helps