【发布时间】:2021-07-11 03:12:35
【问题描述】:
我正在尝试在管道中运行 Azure CLI 任务并收到以下错误:
Starting: AzureCLI
==============================================================================
Task : Azure CLI
Description : Run Azure CLI commands against an Azure subscription in a PowerShell
Core/Shell script when running on Linux agent or PowerShell/PowerShell Core/Batch script when running on Windows agent.
Version : 2.1.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-cli
==============================================================================
##[error]Script failed with error: Error: Unable to locate executable file: 'powershell'. 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.
Finishing: AzureCLI
满足https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-cli?view=azure-devops 中提到的先决条件。
**Pre-requisites mentioned in the ms site :**
Microsoft hosted agents have Azure CLI pre-installed. However if you are using private agents, install Azure CLI on the computer(s) that run the build and release agent. If an agent is already running on the machine on which the Azure CLI is installed, restart the agent to ensure all the relevant stage variables are updated.
我没有使用任何私人代理。我正在使用免费订阅。
管道 yaml 中的任务如下:
- task: AzureCLI@2
inputs:
azureSubscription: 'Free Trial(<My Subscription id>)'
scriptType: 'ps'
scriptLocation: 'inlineScript'
inlineScript: |
az --version
az account show
为什么代理无法在其系统中找到 powershell! 这是一个错误吗?
谢谢!
【问题讨论】:
标签: azure-devops azure-pipelines azure-cli azure-pipelines-yaml