Connect to TFS/VSO Agent inside a VPN - tfs

I am using Visual Studio Team Services (was Visual Studio Online), and I have a build agent installed onto a machine inside a VPN.
Is it possible to configure my build in Team Services and have it run using the agent inside my private VPN? If so, how do you connect to the VPN when running a build?

Yes the agent can run anywhere as long as it can access the VSTS instance (it has a public internet connection).
The basic steps are:
Install the agent on a machine/VM within you network
Run ConfigureAgent.cmd
Set the TFS URL to your VSTS url (https://[account].visualstudio.com)
Provide your creds in the authorization window popup
You're connected!
https://msdn.microsoft.com/en-us/library/vs/alm/build/agents/windows

Related

How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install

I have Jenkins installed on an Ubuntu 18.04.3 LTS desktop PC on my localhost.
I also have an AzureDevOps repo on which I can successfully run a build, through a Jenkins pipeline job, connecitivity achieved via my AzureDevOps personal access token (PAT).
I am now trying to set up a Jenkins service connection or endpoint in AzureDevOps, to enable me trigger an Azure DevOps pipeline release whenever a Jenkins build completes successfully.
To achieve this in AzureDevOps, I am trying to set up access to Jenkins via a Jenkins service endpoint. The endpoint configuration requires among others, a Jenkins "Server URL" (screenshot below). Not surprisingly, AzureDevOps is unable to connect to my Jenkins instance as it's running on my local machine and therefore not publicly accessible.
Any suggestions on how I can overcome this hurdle would be most appreciated.
How to set up an Azure DevOps service connection or endpoint to my localhost Jenkins install
As we know, in order to receive the service hook notifications, you'll need to expose a port to the public internet.
To expose a port to the public internet, you can try to use the tool ngrok:
ngrok exposes local servers behind NATs and firewalls to the public
internet over secure tunnels.
Please check the document Configure a service hook for PR events for some more details.
Hope this helps.

VSTS: Use Docker on a Self-Hosted Windows 10 Agent

I would to use Docker on a Self-Hosted Windwos 10 Agent. To do so I installed Docker for Windows and was able to use it on the agent. But when I wanted to use it with a Docker task in VSTS I got the error:
##[error]C:\Program Files\Docker\Docker\Resources\bin\docker.exe failed
with return code: 1
What is the problem?
The agent service (VSTS Agent (agentName)) was running as Network Service what is not enough to use Docker. It is necessary to run the service in another context. Therefore:
Go to services
Search for the VSTS agent service
Right click on the service
Select properties
Go to the Log On tab
And select Local System account
Then restart the service
Now it is possible to use Docker. See also Docker agent does not run under System Account
EDIT:
I encountered the problem also when the Docker service was running as Local System. In this context it was necessary to run the VSTS agent service as Local System too.

How do I set up a dedicated TFS build server in TFS 2018?

We are using a server running Windows Server 2012 R2 for our TFS work item management and source control.
But we want to set up a dedicated Build server.
We are running TFS 2018 Update1.
I've downloaded the latest available Build agent and ran the script 'config.cmd' from the dedicated Build Server.
In previous versions of TFS you were at least supposed to run the TFS Installation Wizard if I'm correct to configure the Build Service. But this changed since TFS 2015.
But where can you see that my dedicated server (that I used to run config.cmd) is actually used for executing the Build process?
I cannot really find information on how to install and configure multiple servers for running TFS.
as far as I know running the config.cmd is enough. The machine where the script is executed will then register with the server instance - during the configuraiton you had to specify the TFS Server URL right?
On the Server side, you can go to the Agent Pools (where you initially downloaded the Agent Configuration). After clicking on the Agent Pools on the left-hand side you should see all Agents registered to that Queue. To which Queue your agent belongs was as well specified during the configuration on the agent itself as part of the config.cmd.
If you want to add more agents, you can simply run the config.cmd on other machine and register your agent with the same server instance. It is even possible to have more than one agent on the same physical hardware if you want that.

Is it possible to run TFS Build Agent without installing TFS Server on the machine?

I just finished setup two build agent on a server. From what I think, I don't need to install TFS Server on this machine because it use as build agents not the server itself. I might need to install TFS Server to configure the build agents but I hope I can uninstall them after I finished configuring.
I am not sure is it possible to run TFS Build Agent without installing TFS server or not?
You do not have to have the application tier (server) configured on the build agent machine.
You can install the build agent but in order to fully configure the build agent, it will need to be configured against a server's collection (local or remote).
Step 3 in the wizard covered here, details how you need to browse and select the collection the build agent will build for by browsing (it's the same connect dialog you get from the VS client).
Note that if you are using TFS 2012 Build Wizard on-premise (it's released now) it saves you from deploying a server :) At step 3, you point to a cloud hosted account # tfspreview.com, it will prompt you to authenticate and download the service account details for the build agent.
The 2012 wizard is covered here.

Change identity of a TFS build agent

We have a TFS build agent that runs integration tests. Some of these tests make calls to web services on the Internet.
Our network uses a proxy to talk to the Internet.
Since the build agent runs under the identity on Network Service and the settings of Network Service are not configured to use the proxy, the tests fail.
How do I do one of the following?
Change the identity of the build agent to a domain account
Configure Network Service to use the proxy
To change the identity of the build agent you just go into Windows Services and change the identity of the TFSBuild service (service name is "Visual Studio Team Foundation Build").

Resources