Azure DevOps 托管代理 - 向代理添加工具(PS 模块) [英] Azure DevOps Hosted Agents - Add Tool (PS Module) to agent

查看:18
本文介绍了Azure DevOps 托管代理 - 向代理添加工具(PS 模块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有一种简单的方法可以将额外的工具合并到一个默认的 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆