Every so often, I get asked for help with the archiving of Team Projects. The team asking usually no longer wants to see their old Team Projects for whatever reason, but they still want to get it back should the need arise.

Although there currently is no archiving function on TFS, you can still archive these Team Projects. The process described below will work for TFS2010, TFS2012 (all updates) and TFS2013 (all updates). It will not work for Visual Studio Online (TFS Services). If you follow the steps below carefully, you will have a working archiving solution. Do not skip a single step and follow the steps in the correct order!

Since migrating Team Projects between Team Project Collections is a mammoth task, you will probably create a new archive the next time you want to archive some Team Projects in a Team Project Collection that you already have an archive for. Therefor it is important to document what is in each archive.

So here is how you do it:

  1. Stop TFS app in IIS – this is not strictly speaking required, but for safety’s sake…
  2. Stop the Team Project Collection which hosts the Team Projects you want to archive using Team Foundation Server Administration Console.
  3. Back up the Team Project Collection database which hosts the Team Project you want to archive using SQL Server Management Studio. Also backup the Tfs_Configuration database.
  4. Detach the Team Project Collection using Team Foundation Server Administration Console.
  5. Create a copy of the Team Project Collection using SQL Server Management Studio – add the word archive to the name of the copied database.
  6. Attach your Team Project Collections using Team Foundation Server Administration Console, but keep them off-line.
  7. Start TFS app in IIS.
  8. Delete the Team Projects you want to archive from your current Team Project Collection.
  9. Delete the Team Projects you do not want to archive from the archive Team Project Collection.
  10. Bring your current Team Project Collection online.
  11. You can now detach the archive Team Project Collection again and back it up to external media using SQL Server Management Studio or you can bring it online, in which case you need to configure the security for the archive Team Project Collection – you do not want people to have any other than Read access to this Team Project Collection.

There shouldn’t be any problem with skipping step 1 and 7 – stopping and starting of the TFS app in IIS; by taking the Team Project Collection offline, you will also prevent transactions from being handled against the specific Team Project Collection. I just prefer to wear a belt AND suspenders…

When I have a back-up, I will not need it, but when I don’t have one I will need it!