Azure DevOps托管代理-向代理添加工具(PS模块) [英] Azure DevOps Hosted Agents - Add Tool (PS Module) to agent
问题描述
我想知道是否有一种简便的方法将额外的工具合并到默认的Microsoft托管代理池之一(特别是VS2017)中. 基本上,我想添加一些默认情况下未安装的额外的ARM powershell模块,因为仅安装了核心模块集.即我希望利用一些额外的模块(例如AAD)作为投放渠道的一部分,例如创建AAD角色定义.
I am wondering if there is an easy way to incorporate an extra tool to one of the default Microsoft hosted agent pools (specifically VS2017). Basically, I want to add some of the extra ARM powershell modules that are not installed by default as only the core set of modules are installed; i.e. I am looking to leverage some of the extra modules such as AAD as part of the deplyment pipeline, e.g. to create an AAD role definition.
如果我使用CLI而不是PS,我想对于CLI扩展也是一样.
I guess the same would be true for CLI extensions if I was using the CLI instead of PS.
从本质上讲,我想知道是否必须在自托管代理池(我自己的VM)上使用自己的代理,或者是否可以将额外的模块作为部署管道的一部分添加到Microsoft托管代理池VM中,也许是一项任务?
Essentially, I am wondering if I have to use my own agent on a self hosted agent pool (my own VMs) or if I can just add the extra modules to the microsoft hosted agent pool VMs as part of the deployment pipeline, perhaps as a task?
推荐答案
对于PowerShell模块,您只需在嵌入式脚本中(或在现有脚本的开头)使用Install-Module
即可确保已安装.当然,这假定模块在PowerShell库中.
For PowerShell modules, you can just use Install-Module
in an inline script (or at the start of your existing scripts) to ensure they're installed. That, of course, assumes the modules are in the PowerShell Gallery.
最坏的情况是,只需将所需的模块放入源代码管理中,并将它们与其他所有内容一起发布为工件,以便可以加载它们.
Worst case, just put the modules you need in source control and publish them as an artifact along with everything else so you can load them up.
这篇关于Azure DevOps托管代理-向代理添加工具(PS模块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!