Rename TFS Team Project Collection databases

December 3, 2017

When doing TFS migrations I’m often faced with mismatches between the name of the Team Project Collection and the underlying database file name. Instead of keeping track of which TPC is linked with a specific database file name, I recommend to keep the names aligned to avoid confusion.

How to do this?

First, make sure you have a valid backup of the complete TFS environment. The easiest way is to enable a built-in TFS backup plan.

  • Detach the Team Project Collection via the TFS Administration Console

image

  • Detach the matching SQL Server database from SQL Management Studio

SNAGHTMLd6bfa5a

  • Rename the underlying database (.mdf) file to match the desired name for the Team Project Collection (prefix with Tfs_).
  • Attach the SQL database via the renamed .mdf file. A new log file database (.ldf) will automatically be created. You can remove the old .ldf file.

image

  • Attach the renamed database as a Team Project Collection via the TFS Administration Console and apply the desired Team Project Collection name (without prefix Tfs_).

Done!

Advertisements

TFS on-premises, how to add "Test Professional" users?

November 21, 2017

As from TFS 2017 Update 1, the traditional “Advanced” access level where to add users with a Test Professional license became deprecated and there’s no way anymore to add/remove users in this access level group.

Advanced access level has been deprecated. Test Manager extension includes all testing capabilities previously part of the advanced access level.

AdvancedAccessLevel

I noticed this caused a bit of confusion where to add new users with the Test Professional license to still provide them access to the advanced test features in TFS on-premises.

The right approach is first to make sure that the Test Manager extension is installed for the Team Project Collection.

TMExtension

Once the extension is installed, you must navigate to the User Hub for the Team Project Collection where you can assign users to the Test Manager extension.

Users

You must install the Test Manager extension for all active Team Project Collections.


Code & Work Item Search for TFS 2017 – Troubleshooting

November 12, 2017

The Code Search extension for VSTS/TFS makes it easy to search for information across all your projects, from anywhere and any computer or mobile device, using just a simple web browser. You can narrow down your results and focus in on what you need by using filters.

CodeSearch

For TFS 2017 on-premises, Code Search includes Elasticsearch and will be configured on a server running TFS 2017. Work Item Search is now also relying on this functionality.

For large TFS enterprise environments with a lot of big code repositories the Search service might impact the performance of the TFS Application Tier when the Search service has been installed/configured on the same server.

These type of performance issues have been the case for a specific customer and the IT operations team have seen various huge CPU spikes for the Elasticsearch service on the TFS Application Tier.

Together with an in-place upgrade to TFS 2017 Update 3, I recommended to move the Search service to a dedicated server in order to avoid performance issues on the TFS Application Tier. Compared to the typical straightforward TFS upgrade wizard experience, the move of the Search service to another service contains a number of manual activities.

SearchConfiguration

After completing all actions on the dedicated Search server and making sure that the TFS Application Tier could access the Search service on the Search Server via the default port 9200, I was able to complete the upgrade.

The TFS upgrade was a success, except the Search service was not working anymore.

SNAGHTML42be1913

The TFS Administration Console was showing no errors/warnings about the installed Search component.

SNAGHTML42c07979

Looking into some troubleshooting actions from the documentation didn’t help me to get to the root issue because the Search service seemed to be up-and-running, but wasn’t processing any data.

SNAGHTML42c6ccdc

Time to get in contact with the VSTS/TFS Product Team to log this incident and sharing all possible log files (detailed instructions how to do this) and look for potential solutions.

In the end – after some analysis of the logs – I was requested to perform a cleanup of the Index Data and to restart the indexing process on all Team Project Collections.

After going through this entire process, I was happy to see the ElasticSearch process coming to life again and claiming lots of CPU.

image

Also the TFS Search Data/Index folder on the Search Server was quickly getting flooded with a lot of data.

image

Mission finally accomplished! Upgraded to the lastest version of TFS 2017 and moving the Search Service to another server to avoid performance issues on the TFS Application Tier.

If you don’t want to get bothered with all this infrastructure and configuration, there’s an easy way out … Migrate your TFS on-premises environment to VSTS! 🙂


Update appsettings.json at deploy time with VSTS Release Management

July 27, 2017

Lately I have to deal more with .NET Core Web Applications to setup build and release definitions in VSTS. What always comes up is how to deal with specific application settings which must me updated for a specific environment.

I have always been a big advocate of making a clear separation between build and release. The build should simply generate a generic package while the release should pick up the package and deploy it to any possible environment. At deployment time the specific enviroment values should be injected. Web Deploy has been the obvious tool in the past to make this happen with the capability to update the generated setparameters.xml file in a deployment action which injected the environment values into the web.config file.

Now with .NET Core and the typical appsettings.json file, it has become really easy in VSTS to inject custom values into the appsettings.json file.

Example of appsettings.json file in my solution:

AppSettings

Imagine that you would want to replace the values for the different settings (as from line 8). Note that it will also be possible to replace the values in the “Administrators” array.

First, you will need to create a build in VSTS which produces the deployment zip package (via dotnet publish command).

BuildOutput

The VSTS release definition will link to the build output and you can use the built-in release task “Azure App Service Deploy” to deploy the build output to an Azure App Service.

ReleaseTask

The “File Transformation” section in the release task offers the possibility to define the JSON variable substitution. You will need to provide the file name from the root and the environment values (pay attention to the format of the variable names) can be set for the “DEV” environment.

Variables

Doing a file lookup from the console in the Azure Portal after deployment shows the result of the appsettings file.

image

Simple solutions are always the best solutions!


Duration of a Full Backup Job in TFS

April 24, 2017

In order to properly plan a production migration of TFS I often also check the duration of a full backup. The easiest way to see the evolution of the latest Full Backups is to run a simple SQL Query in the TFS_Configuration database …

TFSFullBackupDuration

SELECT [QueueTime], [StartTime], [EndTime], [Result], [ResultMessage], CONVERT(TIME,[EndTime] – [StartTime]) as Duration  FROM [Tfs_Configuration].[dbo].[tbl_JobHistory] jh JOIN [Tfs_Configuration].[dbo].[tbl_JobDefinition] jd on jh.JobId = jd.JobId WHERE jd.JobName = ‘Full Backup Job’ order by HistoryId desc


Upgrade TFS Team Project features

April 20, 2017

When upgrading TFS, the existing Team Projects won’t automatically adopt the new features of the new TFS version. Some of the new features might require some updates to the Team Project. Note that this will only be required for TFS Team Projects … VSTS Team Projects are automatically updated with each service upgrade.

You can perform this update yourself via the Configure Features wizard. If the Configure Features link is visible for your Team Project, it means that the Team Project requires an update. Otherwise, the new features are already enabled.

alm_cfw_configfeatures

This might work if you don’t have a lot of Team Project Collections and Team Projects. During a recent upgrade to TFS 2017 Update 1 at a customer, I was confronted with 31 Team Project Collections and in total a bit more than 400 Team Projects. No way I was going to hit the configure features link 400 times …

I remember having done this already programmatically in the past (https://www.visualstudio.com/en-us/docs/work/customize/configure-features-after-upgrade#program-updates), but the issue now was that there wasn’t a ready-to-use solution for TFS 2017 Update 1. So, I used some tips & tricks from https://www.visualstudio.com/en-us/docs/work/customize/configure-features-after-upgrade#program-updates and also the Features4tfs CodePlex solution was a good starting point. I wanted to have a scenario where it’s possible to scan a complete TFS 2017 environment with all on-line Team Project Collections and all available Team Projects.

As a result, you can find my solution in Github: https://github.com/pietergheysens/TFSUpgradeTeamProjectFeatures. Because it worked for me with TFS 2017 (Update 1), it doesn’t mean it will work for you. Please test it first during a trial-upgrade and see if it helps you to upgrade your Team Projects in one go.


Visual Studio 2017 Launch event

March 15, 2017

Last week on March 7, Microsoft officially launched Visual Studio 2017 and the Visual Studio User Group (VISUG) in Belgium organized a livestream event to watch the keynote together at the local Microsoft office in Belgium.

After the keynote, I did an extra presentation to cover the evolution of VSTS & TFS in the last couple of months.

Ever since the VSTS Product Team has started working in 3 weeks sprints to deliver new features to the product, it has been a real eye-opener to witness how fast the product is evolving and how many new features has been introduced since the beginning of Team Foundation Service, Visual Studio Online and now the current name of the product: Visual Studio Team Services (VSTS). In this demo-heavy session we will have a quick look at some of the new interesting features that were added in the last couple of months.

My slides are available on SlideShare.