Configuring and monitoring Team Foundation Server 2010 Notifications

Team Foundation server notifications are very useful for situations when you want to be notified about various changes to your project such as check-ins , work item changes, build completes or brakes.

Configuring notifications in previous versions of Team Foundation server required manual editing of Web config files of your TFS web service application. In  2010 version most common configuration tasks can be done through TFS administration console UI.

1. Configuring Email alerts on server side

Start up TFS admin console. test

tfsadminConsole

Click on Application Tier tab and scroll down to Email Alert settings.

Click on Alert setting and enter details.

emailalertsettings

Even though your SMTP server doesn’t have to be on same domain as TFS box you can ran into trouble if your SMTP requires authentication.

Setup SMTP authentication details

If you try to use SMTP server which requires authentication you may run into following error found in Windows Server Event Viewer.

 

Detailed Message: TF271001: An error occurred while attempting to send an e-mail notification to the following address: xxxxxx@bizicbojan.com. Further e-mail notification errors that occur within the next five minutes might not be logged. Verify that the e-mail notification settings are correct in the Team Foundation Administration Console.

Exception Message: Transaction failed. The server response was: This server requires PTR for unauthenticated connections. (type SmtpException)

In previous versions of Team Foundation Server it was possible to configure TFS to work with SMTP user name and password, unfortunately IT IS NOT POSSIBLE TO DO DIRECTLY IN TEAM FOUNDATION SERVER 2010.

TEAM FOUNDATION SERVER 2010 DOESN’T SUPPORT SMTP SERVERS WHICH REQUIRE AUTHENTIFICATION.

Googling around I found that:

TFS does not directly support using a username and password to connect to an SMTP server but it is possible to work around this limitation by using an SMTP virtual server on the TFS AT.  That virtual SMTP server can be configured to provide the authentication credentials that the “real” SMTP server needs when relaying messages.  Please consult the following links for more details:

Apparently “TFS 2010 Background Job Agent” service, responsible for sending emails, has hardcoded line such as this:

smtpClient.UseDefaultCredential = true;

However, there is workaround for this issue you can found it on this blog post: http://blogs.msdn.com/b/buckh/archive/2006/07/21/smtp-username-password.aspx?wa=wsignin1.0 

Basically  you need to setup SMTP server which does not require username and password which will “relay” messages to your main SMTP server. You only need to setup SMTP relaying correctly.

2. Configuring Email alerts on client side

Fire up Visual Studio and connect to your team project.

projectAlerts

Right click on your team project and then on “Project Alerts”.

notificationMails

Use this dialog to setup for which notification’s you want subscribe to.

3. Monitoring

To monitor your TFS notifications open Event Viewer, expand Custom Views and click on Application Events and look for Source=TFS Services events.

TFSeventViewver

Additionally you can switch on logging and tracing of your TFS Job Agent by editing config file usually located on this path C:\Program Files\Microsoft Team Foundation Server 2010\Application Tier\TFSJobAgent\TfsJobAgent.exe.config.

Edit following lines under system.diagnostics:

<system.diagnostics>
   <trace autoflush="false" indentsize="4">
     <!--To enable tracing to file, simply uncomment listeners section and set trace switch(es) below.
         Directory specified for TextWriterTraceListener output must exist, and job agent service account must have write permissions. -->
     <listeners>
       <add name="myListener"
         type="System.Diagnostics.TextWriterTraceListener"
         initializeData="C:\jobagent.log" />
       <remove name="Default" />
     </listeners>
   </trace>
   <switches>
     <!--  Trace Switches
           Each of the trace switches should be set to a value between 0 and 4, inclusive.
             0: No trace output
             1-4: Increasing levels of trace output; see Systems.Diagnostics.TraceLevel-->
     <add name="API" value="2" />
     <add name="Authentication" value="2" />
     <add name="Authorization" value="2" />
     <add name="Database" value="2" />
     <add name="General" value="2" />
     <add name="traceLevel" value="2" />
   </switches>
  </system.diagnostics>

 

Enter location for your log file and increase level from 0 to desired level of data in your log files.

Hope this helps Smile

Team Foundation Server auto login

 

When using Microsoft Team Foundation Server from windows domain other than your current logon domain user will be prompted for logon details whenever new connection to TFS is needed.

This can be quite irritating, because every time you start Visual Studio same info has to be provided all over again.

I will give in next few lines short tutorial how to utilize Windows Credential Manager to store user name and password in order to enable Team Foundation Server automatic log on.

1.      In control panel go to Credential Manager

2.      Click on Add Windows credential

3.      Fill in details with address of team foundation server (without protocol prefix), full qualified domain user name and password.

4.      Click ok and you are good to go.

On next start Visual Studio should not prompt for user name and password. If there is ever need for any other user to login beside one added to credential manager , just removed previously added user to CM.

Hope this helps.

About me

Bizic Bojan is Co-Founder of Amida IT-Services GmbH and Software Architect with focus on .NET, C++, Python and Cloud Native solutions. 

 

Disclaimer:

The opinions expressed herein are my own personal opinions and do not represent my employer’s view in any way.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.