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.
I guess the same would be true for CLI extensions if I was using the CLI instead of PS.
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?
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.
来源:https://stackoverflow.com/questions/53383789/azure-devops-hosted-agents-add-tool-ps-module-to-agent