Thursday, May 17, 2012

Rename or Clone TFS 2010 Server

Ever been in the situation where you wanted to make a clone of a production TFS environment, or just needed to rename the server?
Well, I needed to do exactly that for a client recently and spent a couple of hours banging my head on SharePoint in particular.
SharePoint is a very problematic renamer, and I will need to cover that in a separate post, but the rest is fairly straight forward.

Note: I’m assuming that the the login used to perform these tasks is a administrator on the server..

MSSQL Server:

Open up SQL Server Management Studio (or your favourite SQL tool) and connect to the database server. You will notice that if you execute “select @@servername” it will return the “old” or previous server name.

To update this you need to execute the following (replacing the <<oldserver\instance>> and <<newserver\instance>> with your appropriate server names (and instances if applicable):

exec sp_dropserver ‘<<oldserver\instance>>’
GO
exec sp_addserver ‘<<newserver\instance>>’, local
GO

Reporting Services:

Open up “Reporting Services Configuration Manager” and connect to the server, then select “Database”.
Select “Change Database” to display the change wizard.

Select “Choose an existing report server database”, enter the new server name in the next page. Next select the “ReportServer” database and then “Next” until you can “Finish” after verifying settings and applying security scripts.

That should take care of SQL and Reporting Services

TFS 2010:

If you were to open up TFS Administration Console you would find something like this:
image

I must admit that I was surprised (after a bit of digging) that the only change needed to point it to a new server was in the web config file. So go to the TFS web services directory ( By default : %system drive%\Program Files\Microsoft Team Foundation Server 2010\Application Tier\Web Services) and open up the web.config file. In the config file, find the <appSettings> and change the connection string for the “applicationDatabase” to point to your new server name.

Open up TFS Administration Console and you should see some values pulling through now.

The next step is to change the url’s for TFS. In the TFS Administration Console under “Application Tier” select “Change URL’s” and update accordingly.

Now we need to “fix” reporting services. Select “Reporting” in the tree view and click “Edit”. Go to the “Reports” tab of the edit dialog and change the server name. Select “Populate URLs” to reload the correct config.

image

If you do have “schema problems” with either the warehouse or analysis services database, you can change the name and TFS will re-create the databases for you.

Now all that is left to do is to make sure that the project collection’s SharePoint site bindings are correct and you should be A for away..

If this is too dodgy, the next option would be to create a new server from scratch and “port” your existing environment over. I can tell you from experience that is is also not as straight forward as you may think, after all “it is just SQL databases…” backup and restore – right?! …. wrong - but I’ll leave that for another post.…