Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create azure devops windows self hosted agent remotely

Need to create azure devops windows self-hosted agents programmatically (Need to install Remotely for the existing VM).

I have PS script and it is working well if i run it (as admin) inside the virtual machine and agent is getting installed successfully. But i want to create this agent for the existing VM without logging in (Remotely i need to install the agent), because i will need to just add the ARM template in Azure devops pipeline and that should create the Agent for the existing VM.

As this needs to be installed remotely and securely, i shouldn't use custom script due to some restrictions.. It would be really great if we can achieve this installation remotely without custom script and using any other automated way.

Any information will be helpful, thanks.

like image 748
praveen krish Avatar asked Jun 28 '26 14:06

praveen krish


1 Answers

I have found out a way using Run-Command. This is another helpful option to run the PS scripts remotely on a Virtual machine. In addition, this executes the script with elevated permissions which is really helpful in many scenarios.

Source: https://learn.microsoft.com/en-us/azure/virtual-machines/windows/run-command#powershell

This can be performed using via Portal, Powershell and CLI as well.

like image 85
praveen krish Avatar answered Jul 01 '26 04:07

praveen krish



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!