Tim Elhajj

Off the Microsoft stack!

Back up and Restore Data for TFS

How to back up and restore TFS data to new hardware

If you haven’t installed TFS on the new hardware yet, you’ll want to do that now. New for this version of TFS, you can use custom backup and restore tools to manage your data. First you’re going to back up your data, including the encryption key on the report server you used with the previous version of TFS. Next, you’re going to restore your data to the SQL Server instance you set up in step 2. With the restore complete, you’ll use the SQL Server Reporting tool to restart the report server database, restore its encryption key, and then verify access to the report server. If you installed SharePoint, you’ll use a SharePoint command line tool to attach and upgrade your content database.

Required Permissions

To perform this procedure, you must be a member of the Administrators security group on Windows server of the new hardware and the old.

If you plan to configure reporting, you must also be a member of the Administrators security group on the server that is running SQL Server Reporting Services. If you plan to configure SharePoint Products, you must be a member of the Farm Administrators group on the SharePoint Products administration site. If you did not install the Database Engine that will host the configuration database or a database administrator manages the instance of SQL Server that you are using, you must be a member of sysadmin Server role in SQL Server.

Back up your data

If you haven’t installed TFS on the new hardware yet, you’ll want to do that now to access the custom backup and restore tools. You’re going to back up all of your TFS data, including the encryption key for the report server.

Tip: Migrating from Windows SharePoint Services 3.0? Your SharePoint site must be running at service pack 2 or higher to migrate the content database to SharePoint Foundation on the new hardware. If you’re not at service pack 2 or higher, you should update SharePoint before you back up your data.

To run the Team Foundation Server installer
  1. Insert the Team Foundation Server DVD in the drive and launch the tfs_server.exe file to begin the installation.
  2. On the license terms dialog box, accept the license terms and then choose Install Now.
    If you want to install Team Foundation Server to a specific location in the file system, choose the browse button (…) next to the default install location.
To back up the encryption key for reporting services
  1. Launch Reporting Services Configuration Manager.
    For example, on Windows Server 2008 R2, you would choose Start, All Programs, Microsoft SQL Server, Configuration Tools, and then choose Reporting Services Configuration Manager.
    The Reporting Services Configuration Connection dialog box opens.
  2. Specify the name of the report server you used with the previous version of TFS and then choose Connect.
  3. In the navigation bar on the left side, choose Encryption Keys, and then choose Backup.
    The Encryption Key Information dialog box opens.
  4. In File Location, specify the location where you want to store a copy of this key.
    Consider storing this key on the new hardware, so that it’s easily accessible when you restore the Reporting Services databases.
  5. In Password, specify a password for the file.Don’t forget the password! You’ll need it later on to restore the Reporting Services databases.
  6. In Confirm Password, specify the password for the file again.
  7. Choose OK.
To back up your databases
  1. Launch TFSBackup.exe.The TFSBackup.exe tool is in the Tools folder where you installed Team Foundation Server.
    The default location is C:\Program Files\Microsoft Team Foundation Server 11.0\Tools.
  2. In Source SQL Server Instance, enter the name of the SQL Server instance that hosts the TFS databases you want to back up and choose Connect.
  3. In Select databases to backup, choose the databases to back up.
    Need help? List of TFS 2010 databases on MSDN; List of TFS 2008 databases on MSDN.
  4. In Backup Databases to, enter the name of a network share that is configured with read/write access for Everyone, or accept the default location in the file system of the SQL Server you connected to in step 2.
    Note: If you want to overwrite backups stored in this network location, you can choose Overwrite existing database backups at this location.
  5. Choose Backup Now.
    The Backup tool reports progress on each database being backed up.
  6. Choose Close.

Restore your data

To restore your TFS data

  1. Launch TFSRestore.exe.
    The TFSRestore.exe tool is in the Tools folder where you installed Team Foundation Server. The default location is C:\Program Files\Microsoft Team Foundation Server 11.0\Tools.
  2. In Target SQL Server Instance, enter the SQL Server instance you will use as the data tier and choose Connect.
  3. Choose Add Share and enter the UNC path to the network share that is configured with read/write access to Everyone where you stored the backups of your TFS data. For example, \\servername\sharename\.
    If the backup files are located on the file system of the server that is running TFSRestore.exe, you can use the drop down box to select a local drive.
    Note: The service account for the instance of SQL Server you identified at the start of this procedure have read access to this share.
  4. In the left hand navigation pane, choose the network share or local disk you identified in the previous step.
    The TFS Restore Tool displays the database backups stored on the file share.
  5. Select the check boxes for the databases you want to restore to the SQL Server you identified at the start of this procedure.
    Important: For SharePoint, you must only restore the WSS_Content database. Do not restore the WSS_AdminContent or WSS_Config databases. You want the new SharePoint Foundation versions of these databases, not the ones from the previous version of SharePoint or from a SharePoint installation running on any other server.
  6. Choose Overwrite the existing database(s) and then choose Restore.
    The Database Restore Tool restores your data and displays progress reports.
  7. Choose Close.

Fix up the report server

To restart the Reporting Services database and restore its encryption key
  1. Launch the Report Server Configuration tool and restore the original reporting database and its encryption key to your new instance of SQL Server Reporting Services.
    For SQL Server 2008 R2, choose Start, All Programs, Microsoft SQL Server R2, Configuration Tools, and then Reporting Services Configuration Manager.
  2. In Reporting Services Configuration Connection, specify the name of the server where you installed Reporting Services for TFS 2012 and choose Connect.
  3. On the Database page, choose Change Database.
    The Report Server Database Configuration Wizard appears.
  4. On the Action page, choose Choose an existing report server database and then choose Next.
  5. In Server Name, type the name of the SQL server you used in the TFS Database Restore Tool to restore your report server databases and choose Next.
    Choose Test Connection to test the connection.
  6. Choose the report server database you restored with the TFS Database Restore Tool and then choose Next.
    If you haven’t changed the name, the default database name is ReportServer.
  7. On the Credentials page, choose Next.
  8. On the Summary page, review the information and then choose Next.
    The wizard configures the database and displays progress reports.
  9. On Encryption Keys page, choose Restore.
    The Restore Encryption Key window opens.
  10. In File Location, specify the location of the backup file for the encryption key. In Password, specify the password you used when you backed up the encryption key, and then choose OK.
    The status of the restoration appears in Results.
  11. On the Scale-out Deployment page, choose the previous report server from the scale-out deployment status page and choose Remove Server.
  12. On the Report Manager URL page, use the hyperlink in URL to launch the Report Manager site.
    The report manager site appears. Your report server has been restored.
  13. Choose Exit to close Reporting Services Configuration Manager.

Fix up the SharePoint Server

To run the STSADM command line tool for SharePoint
  1. Open a Command Prompt as an administrator on the new hardware that is running SharePoint Foundation.
  2. Change directories to this location:
    Drive:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\bin\

    Where Drive is the drive letter.

  3. In the command prompt, type the following command:
    stsadm.exe -o addcontentdb -url http://WSSServerName/sites -databasename contentdatabase 
    -databaseserver SQLServerName

    WSSServerName is the name of the SharePoint server;
    contentdatabase is the name of the content database;
    SQLServerName is the name of the SQL Server that hosts the content database.

  4. In the command prompt, type the following command:
    stsadm.exe -o addpermissionpolicy -url http://WSSServerName -userlogin Domain\UserName 
    -permissionlevel "full control"

    WSSServerName is the name of the SharePoint server;
    Domain\UserName is the user name and domain of the account used to run the TFS SharePoint configuration wizard and install SharePoint.

Next Step: Run the TFS Upgrade Wizard

Run the Team Foundation Server install from the product DVD and then use the Upgrade Configuration wizard to upgrade your installation.

For more information: Run TFS Upgrade Wizard

15 thoughts on “Back up and Restore Data for TFS

  1. Very well written and descriptive post. I just successfully upgraded my TFS using this post. Certainly a very good read 🙂

  2. Well done!! Great post. I was ALMOST able to follow it to the tee, however I don’t see anywhere where it mentions that you MUST DETACH THE 2010 COLLECTION from the 2010 TFS instance BEFORE you run the backup, at least this was the case in my instance. However, I already have the RTM version, and so was moving my 2010 collections AFTER the RTM upgrade. If I didn’t detach the collections, and then ran the backup/restore, TFS2012 told me nothing was there to attach- but if I detached them from 2010 before backing up, all good.

  3. Hi Kevin, thanks for the kind words.

    I didn’t have to detach any of my TFS 2010 collections to successfully run the back up or restore utility. I know the restore utility (TFSRestore.exe) only recognized backed up databases with the default file extension that SQL Server uses (I think it’s .bak?). If you rename the backup to something different, you won’t see it in the restore utility.

  4. Touche- I should have been more clear. You’re right, I could indeed run both exe’s and see them complete their tasks successfully. It’s just that if I didn’t detach my collections first, they wouldn’t come up as attachable in the 2012 system. Detaching them before running the tfsbackup.exe on them solved this issue. Again, my environment had already been updated from RC to RTM before running these processes. Not sure if that had anything to do with it or not, could see that being the case since the update may(likely) touch every collection DB it’s aware of before completing. Not sure- just thought it may help someone running into the same situation I saw. So besides that, my experience has been you were spot on with the entire article.

  5. Hi Kevin, You’re exactly right. I mentioned this to a colleague and have learned there is an MSDN update planned to explain the need to detach a collection before moving it to a different server. It sounds like you’re using the move process to facilitate an upgrade? I’m going to have to give this a try for myself and see how it impacts this scenario. Thanks for the update. This might make a good topic for a blog post. What prompted you to do your upgrade this way? I’m just curious.

  6. Hello,
    very nice article, but I’ve a Question.
    When I want to Upgrade vom TFS 2010 to TFS 2012 and I only change the Server (Hardware/Windows Version) where the TFS is Installed and my Database Server (other server than TFS Server) will be the same like bevore. Did I need to Run the Db Backup and Restore tool on my DB Server?
    thx much SquadWuschel

  7. Good Question. You should probably back up your data just to be safe, but you don’t have to restore it. Make sure SQL Server meets the new requirements and you should be good to go.

  8. Yes, exactly. I started the work here, on this blog, during beta for TFS 2012. I work at MS. The plan was to collect feedback in the comments on the blog and make sure everything worked well for customers, ensure our ability to update any problems in a timely fashion. Once it all came together, I moved it onto MSDN. There is also an e-book on Smashwords/Amazon, if you want to have it on your Kindle, as a PDF or DOC file.


  9. Hi Tim, this is a great resource! Thank you!
    One question- is it absolutely imperative to first detach the collection database and then perform a backup? I ask as there is some fuzziness (at least to me) around the steps/procedures to a successful upgrade. If this is the case I don’t see it clearly documented in any of the published material. My goal is to migrate to new hardware and upgrade to 2012 from 2010- and I’m searching for a method that avoids outage/downtime to production, a detach of the project collection would certainly do that. Regards

  10. Clint,

    Thanks for the kind words.

    You want the migration path. You should do your backup, restore to the new instance of SQL, and then run the upgrade wizard. Downtime is unavoidable.

    I know some customers like to detach the collections and move them separately, but that’s not really the recommendation, although I believe it will work. A small number of customers have gotten themselves into nasty little problems going that route. What is the allure with that path? Can you explain it? If you are going to move customers to a new instance of TFS, how do you avoid downtime? Whether you move the collection before or after you setup the new TFS, you still have downtime.

  11. Hi every Body,

    I need your help!!, I want to migrate our TFS from 2010 to 2013 version. the TFS 2010 version is in server 1 and TFS 2013 wil be installed in another server (server 2).
    my question is: can i use the same procedure explained above to migrate TFS2010 to TFS 2013 without loosing my projects history?


  12. Abdef, you’re exactly right. Use this same process. You won’t lose your history.

    Here is a white paper that outlines some issues with upgrade. Take a look:


  13. Thanks Tim fro response..

  14. Thank you. The content was very helpful. I installed TFS2015 and Sharepoint 2013 in a new server and restored the TFS databases and WSS_Content in the new server and performed the upgrade. Everything looks to work fine but found an issue with the hyperlink for the documents under All Links of the work item. The documents url is still pointing to the old web site. Please help at your earliest convenience as we have over 25K documents.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s