So You Were Forced to Use the dreaded TFS Collection /Recover Command, Now What? [Updated]

by Angela 27. November 2012 06:06

Since we have used Recover on a production database and lived to tell the tale I thought I would share our experiences. If you read this post you will know that one of my client’s got themselves into a world of hurt where we needed to restore a nightly backup that was not detached.  I know, I know, detached backups, or using the TFS Database Backup Power Tool to backup and Restore, are the way to go.  Well, now THEY know that too Winking smile  Nonetheless, sometimes you may find yourself needing to recover a TFS Team Project Collection (TPC) database, and if you’ve read the MSDN documentation you’ll know this is not an ideal situation. The Recover command is very lossy, BUT you get your data back. And in our case it was worth the risk.

So here is the backstory…  Someone deleted a Test Plan with a month’s worth of data in it, and if you know MTM you know there is no “undelete”. Restoring a backup was our only hope. BUT our nightly backups are SQL backups of the entire SQL Server instance, so undetached (we are addressing this NOW). The TFS Backup Power Tool does not detach the databases before backing them up, but it automates something a bit more complicated to allow you to restore single collections from a full backup. Plucking one TPC out of what we had, and attaching it to the TFS instance was just not an option.  You cannot attach a collection that thinks it is already attached.  Trust me, I know. And unfortunately we did not have extra hardware sitting around to allow us to restore the entire thing to a different instance to detach it properly.  So here is what we did:

  1. Restore the backed up TPC from the nightly backup into our dev TFS environment
  2. Used the TFSConfig /Recover command, followed by TFSConfig /Attach to get it attached in dev
  3. Used the TFSConfig /Recover command to get the TPC into the proper state
  4. Detach the hosed TPC from production
  5. Restore that detached version of the TPC to production
  6. Attach the backup to production (we actually hit an interesting bug in TFS 2010 at this point, so the attach was quite harrowing and involved an emergency hotfix to our TFS sprocs, I may blog about later.)

Now, I would love to say everything was perfect but the recover command did blow away some things that we had to get back into place before people could use the TPC again.  What we lost:

  1. All the security setting ever!
    • Collection level groups and permissions
    • Team Project (TP) level groups and permissions in every TP in the TPC
    • Permissions around Areas and Iterations in every TP in the TPC
    • Permissions around Source Control in every TP in the TPC
  2. SharePoint settings  (in every TP in the TPC). Settings on the SharePoint server themselves will be fine of course but you will probably see a “TF262600: This SharePoint site was created using a site definition…” error when you try to open the portal site that was once attached to those TPs. You will need to fix this in 2 places.
    • Go to TFS Admin Console, select the TPC you just restored and make sure the SharePoint Site settings for the TPC are correct. It will probably be set to “not configured” now.
    • Open team explorer (as an Admin user), and for each TP go to “Team Project Settings | Portal Settings” and verify everything there is correct. Ours were just plain gone so we had to enable the team project portal and reconfigure the URL.
  3. SSRS Settings – this will probably be fine if you restored the database as-is but we also renamed it as part of the restore, and so had to update the Default Folder Location through the Admin Console for the TPC in order for this to work again.

So word to the wise, make sure you understand what the settings above are for all of the TPs in your TPC BEFORE you perform a Recover command because chances are you will have to manually set them all back up. And please, PLEASE backup your TFS databases properly.



Hmm, So Apparently TFS 2012 Power Tools Require VS Pro or Better

by Angela 19. November 2012 15:37

So I had gotten used to installing a VS 2010 Shell on my TFS app tier for doing basic administration type activities that required a Team Explorer. One of my most common tasks was editing the TFS process template using the TFS Power Tools. So when I upgraded TFS to 2012, I immediately downloaded the TFS 2012 Team Explorer and Power Tools and installed them so I could get to work.

Today I discovered that is no longer a supported scenario once you have upgraded to TFS 2012, not that the error message is AT ALL helpful for figuring this out, shocking. I loaded up the VS Shell, opened Tools | Process Editor | Work Item Types | Open WIT from Server like I always do


and got a strange error I hadn’t seen before. I tried a few other options, projects, work item types, kept getting errors. I was able to export work items, just not open them. ::sad trombone::  So this is an error you might end up encountering after upgrading if you haven’t seen the update I am talking about.


Cannot load ‘C:Users37653\AppData\Roaming\Microsoft Corporation\Microsoft® Visual Studio® 2012\11.0.50727.1\usnbka366p_Str_Enterprise_User Story,wit’: Could not load file or assembly Microsoft.VisualStudio.XmlEditor,Version=1, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a or one of its dependencies. The system cannot find the file specified.


When I dug around, I discovered a few MSDN posts referring to a licensing change for VS 2012.  I suppose if I still worked at Microsoft I wouldn’t have missed that valuable little nugget. So no longer can you get away with a free VS Shell and the Power Tools for simple administrative tasks on your server, you must install at LEAST VS Professional.  Lame.

If you are lucky, like me, your boss bought you a copy of VS Ultimate and it’s not an issue since with MSDN benefits, you can install it on pretty much any server YOU are going to use. Just be sure if it is a shared server, that everyone is properly licensed for whatever you install there. And alas, this is at my client, so now I need to work with their server folks to get that installed and make sure they are licensed properly for it ::sad face::


ALM | Application Lifecycle Management | MSDN | Power Tools | SDLC | TFS 2010 | TFS 2012 | TFS Administration | TFS Power Tools | Team Foundation Server


Application Quality Enablement with TFS 2012 and MTM 2012 at SDC Tomorrow

by Angela 14. November 2012 05:00

Not sure if you’ve been to any of the sessions held by the Software Development Community in Chicago but they are always good. This month I get the opportunity to speak there myself and wanted to let folks know.  If you cannot make it to my session tomorrow, I will be presenting the information again at the Visual Studio launch event in Chicago (“The New Era of Work”) later this month as well.  Be sure to sign up for notifications of future SDC meetups, it’s a great group! 

In the meantime, here is the info for my session tomorrow:

When: Thursday, November 15, 2012 -- 5:45

Where:  i.c.s -- 415 N Dearborn, Chicago, IL (map) -- 3rd Floor, Sign will be posted at the door.

Session: Application Quality Enablement with TFS 2012 and MTM 2012 - With the rise of modern apps and the modern data center, we require a modern lifecycle approach that supports the need to increase velocity, deliver continuous value and manage change while enabling quality. See a unique and full lifecycle perspective on quality enablement with rich demos infused along the way to illustrate our the software testing/QA story. Demos will include:
• Product Backlog
• Storyboarding
• Exploratory testing
• Client Feedback


Multi-Tenant TFS Data Tiers? Yes You Can!

by Angela 6. November 2012 08:27

Multi-what TFS? In other words, hosting multiple instances of Team Foundation Server data tiers and all of their associated databases on the same data tier.

So we ran into quite the conundrum here, wherein we had just one physical server available to act as a TFS Data Tier, but needed to host at least 2 TFS 2010 instances on it to try some stuff out in relation to a coming upgrade. I needed to upgrade a number of our project collections to TFS 2012, while leaving some number still on TFS 2010 until we could do further validation on some customizations. It seemed risky, maybe even impossible, but mostly because I had never tried.  I certainly never saw that as an option in the installation docs or on MSDN.  It wasn’t until I sat down with a DBA who looked at it purely from a database perspective that I thought to just give it a try and see what happened. Obviously this is a development environment and NOT their production TFS Smile  You certainly COULD do this in production but it would make me nervous when it came to things like DR, so I’m not going to even entertain that notion.  But, in my situation, I already had a dual tier TFS 2010 environment setup in DEV, and I had a second AT server to use as a test bed for the upgrade to TFS 2012, but my main issue was how I could take collections from a single TFS instance, and upgrade only half of them to 2012 while the others were still available on 2010. I wondered, “can I upgrade the new app tier to 2012 while leaving the other app tier, hitting the same data tier, on TFS 2010?” The answer is, “sure you can!” 


Now if you look at TFS merely from the front end perspective this might seem odd, or risky, but like I said, I had a DBA who knew nothing about TFS but knew databases really well helping me to noodle through it.  I knew just enough about SQL Server to be dangerous, so together we made quite the team when it came to “let’s just try it and see what happens, it’s only DEV after all!”.  What I came to understand, and maybe I should have realized this sooner, is that when you upgrade TFS, or do any operations on it from the App Tier, it only affects the databases that are referenced by its configuration database.  So, 3 separate App Tiers have 3 separate Configuration databases, and 3 separate sets of databases (Collections, warehouse, etc.) that can coexist on a single data tier. So upgrading an AT from TFS 2010 to TFS 2012 only updates the schemas of the databases specified in the Configuration database associated to that AT.  Main requirement here is that it is a version of SQL that can support both products, so SQL 2008 R2 + current Service Packs.

So here is what I am running today:


Looking back, knowing what I now know, it makes sense too. Now, once again, I spent many many hours researching this on-line and could not find any documentation to confirm or deny that this was even possible. It took a few emails to some folks in North Carolina, you know – the dudes who WROTE the software – to confirm that yes indeed, you can host multiple instances of TFS on a single Data Tier. Turns out, they do it too! So I was pretty stoked to discover that I could in fact host 2 different TFS instances on a single Data Tier machine AND that it was a supported (although completely undocumented) scenario.

Rad huh? When you dig into the SQL Server instance it can become a confusing mess of config databases, and collection databases to manage, but it can also be a useful thing to know for upgrade and testing scenarios where you simply cannot get additional hardware for the DT.  Now yes, this absolutely can make things tricky for the DBA too if you are not using the TFS Backup and Restore Tools for backing up data. I certainly recommend using the built in TFS Backup tools if it is an option. But that is a discussion for another day… and another blog post.

I will happily accept dark chocolate in tribute Smile


ALM | Agile | SDLC | Power Tools | TFS 2010 | TFS 2012 | TFS Administration | TFS Power Tools | Team Foundation Server


Why Isn’t TFSService In My Service Account Dropdown List?

by Angela 5. November 2012 09:45

Ever been migrating a TFS 2010 server and when you got to the place in the Application-Tier Only Wizard where you had to specify a Service account and POOF, your TFSService account did NOT appear as a possible option? Ruh-roh!  This is a known issue in TFS 2010, and you won’t encounter this in 2012 thankfully, but nonetheless. If it happens to you, hopefully this also works for your implementation!


Now you certainly don’t want to be specifying a user account for this, but what on earth is a TFS admin to do? I got into this situation and fear not, there is NOTHING documented on-line to help you ::maniacal laughter:: Maniacal mostly because I beat my head on my desk for at least half a day trying to figure this out.  Nothing I could find on MSDN, the MSDN forums or any other searchable resource shed any light on the issue. I found the solution by calling in a favor with a couple of folks I know on the TFS product team.  I might seriously send them a cookie basket for being so awesome.  Seemed silly not to share my good fortune because this is a DOOZY if you ever run into it yourself.

Turns out, the values that go into this dropdown get collected by taking a poll of all of the TFS related SQL databases (configuration, warehouse, collections) referred to by the configuration file selected in the previous step. Obviously you need to select an account that can access all of the databases.  The account should a) not be dbo, b) not be db_owner, and c) needs to be a valid user with TFSADMINROLE and TFSEXECROLE. In my case, some folks had been having issues creating new Team Project Collections (because their TFS Admin accounts did not have proper permissions on the Data Tier) and so they logged into the AT as TFSService to create the collections ::head explodes::  Doing that makes TFSService dbo and dbo_owner and therefor pulls its name out of the proverbial hat to be used as the service account going forward.

So how do you fix it? a) make sure your TFS Admins have the appropriate rights on all of the servers they need to get their jobs done going forward and DO NOT take no for an answer.  Trust me, it’s brutal otherwise; b) Take TFSService OUT of the administrators group on the local server so no one can login as that user in the first place; c) go fix the TFSService account in the TFS related databases in SQL Server. This may seem scary, but I don’t know of another way.  Ask your DBA if you need to, it’s possibly their fault you got in this situation anyway Winking smile 

So what you need to do in SSMS to fix it?

  1. 1) Iterate through all of the TFS databases and change the Owner to something OTHER than TFSService; this will also reset the login associated to the dbo user. Keep in mind if this user is already in the Users group for that database, then they will need to be deleted from there first.
  2. Untitled

2) Add TFSService as a database user (Database | Security | Users –> New user…)

3) Assign them the following roles: TFSADMINROLE and TFSEXECROLE.



And after you’ve given yourself carpal tunnel with the billion mouse clicks necessary to do this, you can restart the Application Tier Only wizard and you will find that now TFSService appears in your list. HUZZAH! ::throws confetti::


Now ideally you will never get into this situation in the first place, but if you do, it’s not really documented other than this blog post – at least not that I know of. BIG THANKS to Brian MacFarlane and Ed Holloway on the TFS Product Team for helping me noodle through this issue.


ALM | Application Lifecycle Management | MSDN | TFS | TFS 2010 | TFS 2012 | TFS Administration | Visual Studio

Powered by BlogEngine.NET
Original Design by Laptop Geek, Adapted by onesoft