[英]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).需要以编程方式创建 azure devops windows 自托管代理(需要为现有 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.我有 PS 脚本,如果我在虚拟机中运行它(以管理员身份)并且代理安装成功,它运行良好。 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.
但是我想在不登录的情况下为现有 VM 创建此代理(我需要远程安装该代理),因为我只需要在 Azure devops 管道中添加 ARM 模板,这应该为现有 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.任何信息都会有所帮助,谢谢。
I have found out a way using Run-Command.我找到了一种使用 Run-Command 的方法。 This is another helpful option to run the PS scripts remotely on a Virtual machine.
这是在虚拟机上远程运行 PS 脚本的另一个有用选项。 In addition, this executes the script with elevated permissions which is really helpful in many scenarios.
此外,这会以提升的权限执行脚本,这在许多情况下非常有用。
Source: https://docs.microsoft.com/en-us/azure/virtual-machines/windows/run-command#powershell来源: https : //docs.microsoft.com/en-us/azure/virtual-machines/windows/run-command#powershell
This can be performed using via Portal, Powershell and CLI as well.这也可以通过 Portal、Powershell 和 CLI 执行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.