I was asked the other day how to rename a Team Project Collection.
There is a way, and it is more like a three card shuffle than anything else, and will work in TFS2010 and TFS2012.
The super quick guide: You detach the collection, and rename it on the reattach.
The step by step guide
1. Notify all the users and agree a time to do this, allocate at least half an hour to have breathing space.
You need to ensure that there are no builds or tests running, and have enough time to reset the build and test controllers and agents to point to the renamed collection. This is also assuming that you are going to keep the collection on the same SQL instance. so don’t need to consider the move from Enterprise to Standard edition (compression).
2. Log on to the server locally
3. Open the Team Foundation Server Administration Console
Accept the User Access Control if shown
4. In the console
a) Click on Team Project Collections
b) Click on the Team Project that you want to rename
c) Detach the collection
Note: The collection will get stopped and a servicing message will get displayed in the detach operation
5. This will invoke the detach wizard
a) Add a servicing message, and click next
b) Click on Verify
c) Click on Detach, after reviewing and accepting any warnings!
The warnings in this case were:
This collection has SQL Enterprise features enabled. If you are moving the collection across SQL Server Editions please read the documentation (http://go.microsoft.com/fwlink/?LinkId=166007) to see how this impacts you.
Some build resources are enabled. If any builds are running during the servicing operation, they will be stopped by the system.
6. This has detached the Team Project Collection. It will not appear in the administration console, and you will not be able to access it.
The Build warnings were the disabling of the controller and the agent.
7. This is an opportunity to rename the database to keep consistency. I recommend it, as it will keep the naming convention.
Open SQL Server Management Studio
Right click on the Team Project Collection database that you want to change, and click on rename
Enter the new name and click Enter. By default the database name starts with TFS_, after that is the TPC name
8. Now the TPC can be re-attached, with rename
Back in the TFS Admin console, click on Attach Collection
9. This opens the attach wizard
a) Select the database for the Team Project Collection that you want to reattach, click Next
b) Now we are the place that we have been working towards – renaming the Team project Collection. Enter the new name, (that should match the database) click Next
c) Check what has been entered, and if it is OK click Verify
d) If everything is OK, click Attach
e) Click Complete to see the summary (or click close to exit)
View the complete results, and click close
9) Now it is tidy up time
a) Repoint all Build controllers and agents to the newly named Team Project Collection
b) Repoint all Test controllers and agents to the newly named Team Project Collection
c) Confirm Connectivity
d) Run a test build and test run
10) You are done – go and grab a coffee before the next task!