Our DevOps pipeline has been running on Microsoft-hosted agents. However, to help lock down our environment we are now moving to self-hosted agents (specifically, so we can deploy code to a Function App which has a private endpoint).
We have selected Scale Set Agents, and have got started by following this page. This has solved our immediate problem, in that our AzureFunctionApp@1
tasks are running happily on the new agent pool.
However, we are struggling to run various other tasks on the new agents. In particular, PowerShell@2
and AzureCLI@2
tasks are failing. Presumably both rely on PowerShell; in both cases we are seeing the error:
##[error]Unable to locate executable file: 'pwsh'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
I was expecting Azure Devops to configure the Scale Set Agents similarly to the Microsoft-hosted ones, but perhaps that is not the case. Do I need to use a Custom Script Exetension to install PowerShell?
We are using the UbuntuLTS
VM image, as per the guide linked above.
I was expecting Azure Devops to configure the Scale Set Agents similarly to the Microsoft-hosted ones, but perhaps that is not the case.
It will not any tooling. The agent you installed just allows using the machine as build agent. Everything else must be part of the VM image or installed afterwards.
Sadly MS cannot distribute their images but it is possible to build them for your own use: https://github.com/actions/runner-images/blob/main/docs/create-image-and-azure-resources.md