Installing TFS Deployer

The current version of TFS Deployer is designed only to work with Team Foundation Server 2010. Older releases of TFS Deployer that work with TFS 2005 and TFS 2008 are available for Download but are no longer supported.

Please ensure your deployment machine has the following prerequisites installed before installing TFS Deployer:
  1. .NET Framework 3.5 SP1
  2. PowerShell 2.0
  3. Team Explorer 2010 or Team Foundation Components 2010 or the newly available Team Foundation Server 2010 SP1 Object Model or Team Foundation Server 2012 Update 1 Object Model

1. Download & Save TFS Deployer

Download TFS Deployer and create a folder on the machine you wish to deploy to in your %programfiles% directory by the name of "TfsDeployer" (no installer at this time). The release contains a zip file that contains the executable program and the default configuration files into the C:\Program Files\TfsDeployer directory - from there you need to perform a few configuration steps which we haven’t fully automated yet.

2. Register TFS Deployer as a Service

The first step is to get the service to self register. This is done by executing the TfsDeployer.exe program with the -i switch. Navigate to the %programfiles%\TfsDeployer directory with your command prompt and execute this command:
TfsDeployer.exe -i

3. Establishing Service Account To Run TFS Deployer

The account that the TFS Deployer service runs under must have permissions to:
  1. Subscribe to TFS Build Quality Status Change events. Either add the service account as a member of the ‘Team Project Collection Administrators’ group, or grant the permission directly via the command line, for example: tfssecurity.exe /a+ EventSubscription $SUBSCRIPTION: CREATE_SOAP_SUBSCRIPTION n:YourDomain\YourTfsDeployerAccount ALLOW /collection:http://YourTFS:8080/tfs/YourCollection
  2. Retrieve content from TFS Version Control. (Adding the service account to the team project's Readers group is easiest.)
  3. Read files on the Team Build drop file share.
  4. Deploy the build on the target machine. The PowerShell instance that TFS Deployer creates will inherit the identity of the TFS Deployer service. So this account will need all the permissions necessary to deploy the build (typically a member of the local machine's Administrators group).
  5. Listen on the configured HTTP endpoint. This can be configured via the built-in "netsh" command, for example: netsh http add urlacl url=http://+:8881/ user=YourDomain\YourTfsDeployerAccount

The firewall must also be configured to allow inbound connections on the listening port. For the Windows Firewall, this can also be configured via the built-in "netsh" command, for example:
netsh advfirewall firewall add rule name="TFS Deployer Notification" dir=in action=allow protocol=TCP localport=8881 remoteip=localsubnet profile=domain

4. Edit Configuration Settings

Before starting the service review the settings in the TfsDeployer.exe.config configuration file, the relevant settings are:
  • TeamProjectCollectionUri: the address of TFS Team Project Collection for which TFS Deployer will subscribe to events.
  • BaseAddress: the address that Team Foundation Server will use to contact this TFS Deployer instance. This address must be resolvable from the Team Foundation Server machine so localhost is not applicable.
  • TfsUserName, TfsDomain and TfsPassword: Optional. Only specified if TFS Deployer should authenticate with the Team Foundation Server using credentials different from the service account.
  • system.net\mailSettings\smtp: this section must configured with a from address and either an SMTP server or drop folder for TFS Deployer to send emails with the results of deployments. More information in the MSDN Library

5. Configure and Starting the TFS Deployer Service

  1. Open the Services management console (eg Start > Run > services.msc).
  2. Locate and double-click the TFS Deployer service.
  3. Select the Log On tab in the Properties dialog.
  4. Enter the username and password of the chosen TFS Deployer service account (from section 3 above).
  5. Click Ok.

6. Configure a suitable execution policy in PowerShell

  1. Open an elevated PowerShell session. (Ensure you use the PowerShell architecture for your operating system, ie x86 vs x64).
  2. Set the execution policy to either AllSigned, RemoteSigned, or Unrestricted. For example: Set-ExecutionPolicy RemoteSigned
For more information about Execution Policies see http://technet.microsoft.com/en-us/library/dd347641.aspx.

7. Start the TFS Deployer service.

At this point in time TFS Deployer will connect to Team Foundation Server and subscribe to all build quality indicator change notifications.

Troubleshooting

See Test-TfsDeployerInstall for automated troubleshooting.
  1. Stop the TFS Deployer service.
  2. Open a Command Prompt using the TFS Deployer service account credentials (ie run as)
  3. Execute: TfsDeployer.exe –d
This will run TFS Deployer on the console with more visibility as to whether the service is successfully subscribing to TFS events and receiving the notifications.

The PowerShell script will be receiving the build number and drop location from TFS Deployer. If you structure your script as follows, you can launch it directly from the Powershell command line (with command line arguments) to help troubleshoot it:
$buildNumber = $TfsDeployerBuildDetail.BuildNumber
$dropLocation = $TfsDeployerBuildDetail.DropLocation
if($buildNumber -eq $null)
{
  $buildNumber = $args[0]
  $dropLocation = $args[1]
}


  • If the service fails to execute your script, you can change to a directory similar to this one - this is where the service does the “get” of your deployment mappings and script:
C:\Documents and Settings\tfsdeployer_svc\Local Settings\Temp\TFSDeployerConfiguration2
  • In this location you will be able to launch your powershell script directly and supply the required command line arguments.
  • Enable Tracing: You can enable tracing by un-commeting the trace switch at the bottom of the config file.
<system.diagnostics>
  <switches>
    <add name="Readify.Useful.TeamFoundation.Common" value="Verbose" />
    <add name="TfsDeployer" value="Verbose" />
    <add name="TfsDeployer.DeployAgent.DeploymentHostUI" value="Verbose" />
  </switches>
  <trace autoflush="true" />
</system.diagnostics>

Last edited Jan 22, 2013 at 8:41 PM by jstangroome, version 29

Comments

jstangroome Jun 11, 2012 at 11:15 PM 
@dazu: the $ in $SUBSCRIPTION in point 3 will probably need to be escaped to work in PowerShell, eg: `$SUBSCRIPTION

dazu Jun 11, 2012 at 9:13 PM 
For steps in point 3 You need to use command shell. It won't work with ps window