How to: Set up a Build Agent to Require HTTPS and Secure Sockets Layer (SSL)
To configure a build agent for SSL connections, you must configure an HTTPS certificate for each combination of IP address and port. If all build agents share the same port on the build computer, you must configure only a single certificate. If you run more than one build agent on more than one port, you must configure a certificate for each port.
Before configuring a build agent for SSL connections, make sure that you meet the following prerequisites:
You have access to administrative credentials for Windows on the build computer.
Team Foundation Build and Team Explorer are installed and operational.
A certificate has been issued for the build agent. For more information, see Walkthrough: Setting up Team Foundation Server to Require HTTPS and Secure Sockets Layer (SSL).
Windows Support Tools is installed on the build computer. This is required to associate a certificate with the IP address and port. For more information about Windows Support Tools, see https://go.microsoft.com/fwlink/?LinkId=93827.
To configure a build agent to require SSL, perform the following tasks in sequence:
Create and configure the build agent to require HTTPS.
Stop the Visual Studio Team Foundation Build service.
Modify the build service configuration to require HTTPS.
Associate a certificate with the IP address and port.
Configure the port and protocol for the build agent.
Restart the Visual Studio Team Foundation Build service.
Verify the SSL configuration.
Required Permissions
You must be a member of the Administrators group on the computer on which Team Foundation Build is installed to complete this procedure. For more information, see Team Foundation Server Permissions.
To configure the build agent to require HTTPS
In the Manage Build Agents dialog box, select the Require Secure Channel (HTTPS) check box.
For more information, see How to: Create and Manage Build Agents.
Click Edit.
In the Build Agent Properties dialog box, select Disabled from the Agent status drop-down menu.
To stop the Visual Studio Team Foundation Build service
Log on to the build computer by using an account that is a member of the Administrators group on that computer.
On the build computer, click Start, click Control Panel, click Administrative Tools, and then click Services.
In the Services (Local) pane, right-click Visual Studio Team Foundation Build, and click Properties.
The Visual Studio Team Foundation Build Properties (Local Computer) dialog box opens.
Under Service Status, click Stop.
To modify the Visual Studio Team Foundation Build configuration to require HTTPS
Log on to the build computer by using an account that is a member of the Administrators group on that computer.
Open Root:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies, right-click TfsBuildservice.exe.config, and click Open.
The file opens in the XML editor for Visual Studio.
Change the value of the RequireSecureChannel key, which is located in the <appSettings> section, to "true".
For example, change the key definition to the following string:
<add key="RequireSecureChannel" value="true" />
Save your changes, and close the file.
To associate an SSL certificate to an IP address and port number
Log on to the build computer by using an account that is a member of the Administrators group on that computer.
Note
Install the certification for Visual Studio Team Foundation Build service in the Team Foundation Build Service account’s personal store or in the Local Computer’s personal store. If you install the certificate in the personal store of logged in user, Team Foundation Build will not run.
Use the Certificates snap-in to find an X.509 certificate that has an intended purpose of client authentication.
For more information, see https://go.microsoft.com/fwlink/?LinkId=93828.
Copy the thumbprint of the certificate into a text editor, such as Notepad.
Remove all spaces between the hexadecimal characters.
You can remove spaces by using the text editor's find-and-replace feature to replace each space with a null character.
On the build computer, click Start, click All Programs, click Windows Support Tools, and then click Command Prompt.
Execute the HttpCfg.exe tool in "set" mode on the SSL store to bind the certificate to a port number.
The tool uses the thumbprint to identify the certificate, as shown in the following example:
httpcfg set ssl /i 0.0.0.0:9191 /h ThumbprintWithNoSpaces
The /i parameter has the syntax of IP-address:port and instructs the tool to set the certificate to port 9191 of the build computer. The IP address 0.0.0.0 reserves all computer addresses for simplicity. If you need additional precision, specify the exact IP address on which the agent service is published. The /h parameter specifies the thumbprint of the certificate.
If the client certificate must be negotiated, add the argument /f 2 as shown in the following example:
httpcfg set ssl /i 0.0.0.0:9191 /h ThumbprintWithNoSpaces /f 2
For more information about the syntax of the HttpCfg.exe command, see https://go.microsoft.com/fwlink/?LinkId=93829.
Note
If you are using Windows Vista or Windows Server 2008 operating systems, use netsh.exe instead of HttpCfg.exe. For more information about netsh.exe, see https://go.microsoft.com/fwlink/?LinkId=98790.
To configure the build agent port and protocol
At the command prompt, run wcfhttpconfig freePortNumber.
The command statement should resemble the following string:
wcfhttpconfig free OldPortForHttp
For more information, see wcfhttpconfig (Team Foundation Build).
At the command prompt, run wcfhttpconfig reserveUserAccountURL.
The command statement should resemble the following:
wcfhttpconfig reserve Domain\Account https://+:NewPortForHttps/Build/v2.0/AgentService.asmx
Add the port to the exceptions list for Windows Firewall.
To restart the Visual Studio Team Foundation Build service
Log on to the build computer by using an account that is a member of the Administrators group on that computer.
On the build computer, click Start, click Control Panel, click Administrative Tools, and then click Services.
In the Services (Local) pane, right-click Visual Studio Team Foundation Build, and click Properties.
The Visual Studio Team Foundation Build Properties (Local Computer) dialog box opens.
Under Service Status, click Start.
To verify the SSL configuration
In the Manage Build Agents dialog box, click Edit.
In the Build Agent Properties dialog box, select Enabled from the Agent status drop-down menu.
For more information, see How to: Create and Manage Build Agents.
Verify whether communication is occurring by executing a build using the build agent.
For more information, see How to: Queue or Start a Build Definition.
See Also
Tasks
Walkthrough: Setting up Team Foundation Server with Secure Sockets Layer (SSL) and an ISAPI Filter
Concepts
Team Foundation Server, HTTPS, and Secure Sockets Layer (SSL)
Team Foundation Server, Basic Authentication, and Digest Authentication
Other Resources
Securing Team Foundation Server with HTTPS and Secure Sockets Layer (SSL)