Setup a build agent for Azure Devops

Recently I had to install an instance of Azure Devops Server (Azure Devops On Premise).

Between the constraints I had, the most important was, that all the system is not able to see Internet.

So installing a build agent was required.

Generating an offline installer for vs_BuildTools

So first things first, from your connected computer, let’s download vs_BuildTools.exe here.

Once you have it, you will have to check the list of workload available for the agent at the address. You will have to select the one you need and open Powershell.

Now you can generate the offline installer using the following command (exemple);

.\vs_BuildTools.exe --layout C:\Users\xxx\Documents\buildTools\Offline --add Microsoft.Visual
Studio.Workload.ManagedDesktopBuildTools --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio
.Workload.NetCoreBuildTools --add Microsoft.VisualStudio.Workload.NodeBuildTools --add Microsoft.VisualStudio.Workload.U
niversalBuildTools --add Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools --add Microsoft.VisualStudio.Wo
rkload.WebBuildTools --add Microsoft.VisualStudio.Workload.AzureBuildTools --includeOptional --lang en-US

Install the Build Tools on the build agent

You will have to copy the output located in the folder you provided in the previous step to the agent.

Once this is done, you must register the certificates present in the folder by double click on them.

You can now open Powershell and run the following command :

.\vs_BuildTools.exe --add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools --add Microsoft.VisualStudio.Workload.MSBuildTools --add Microsoft.VisualStudio.Workload.NetCoreBuildTools --add Microsoft.VisualStudio.Workload.NodeBuildTools --add Microsoft.VisualStudio.Workload.UniversalBuildTools --add Microsoft.VisualStudio.Workload.VisualStudioExtensionBuildTools --add Microsoft.VisualStudio.Workload.WebBuildTools --add Microsoft.VisualStudio.Workload.AzureBuildTools --includeOptional

Frameworks

You can now install the .NET Framework that you need (or NET Core) and also NodeJs if needed.

Configure the Agent

Now that you have install the build tools on the agent you will have to configure the Agent in order to work with Azure Devops

Generate the PAT token

You have to first create the PAT from your profile (you can acces it through you security detail)Creation PAT

When the token is generated keep it somewhere, because you are gonna need it.

Download the agent to install

Through the collection settings you can go to Agent pools

And download the Agent

Now copy the zip to you agent and run the command display in the previous window.

Configure the agent

Now run the .\config command and give the needed information.

The url of your server will be https://server/organization

Then when the way of connect is asked just type PAT and at the next step copy the token previously generated.

Install it as a service.

Configure Git

Now with Git you may face an issue pulling the source in order to build.

So the gitconfig file embedded with the agent has to be configured.

The gitconfig file is present at this place (agent is the place where I installed the agent) C:\agent\externals\git\mingw64\etc

In the http section you can put sslBackend = schannel

or if you really don’t care about security sslVerify = false (beware of man in the middle)

Conclusion

You should now this you agent available from Azure Devops and you are able now to build your projects

Votre commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:

Logo WordPress.com

Vous commentez à l’aide de votre compte WordPress.com. Déconnexion /  Changer )

Photo Google

Vous commentez à l’aide de votre compte Google. Déconnexion /  Changer )

Image Twitter

Vous commentez à l’aide de votre compte Twitter. Déconnexion /  Changer )

Photo Facebook

Vous commentez à l’aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s