相关疑难解决方法(0)

错误:在 ADO 管道中运行 Azure CLI 任务时无法找到可执行文件:“powershell”

我尝试在管道中运行 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://learn.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 …
Run Code Online (Sandbox Code Playgroud)

azure-cli azure-devops azure-pipelines azure-pipelines-yaml

15
推荐指数
2
解决办法
1万
查看次数

如何从 DevOps 管道安全地登录 Az CLI

我想从我的 Azure DevOps Pipeline 执行 AZ cli 命令。在我的 YAML 文件中,我有这个:

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- task: UsePythonVersion@0
  inputs:
    versionSpec: '3.x'
    architecture: 'x64'

# Updating pip to latest
- script: python -m pip install --upgrade pip
  displayName: 'Upgrade pip'

# Updating to latest Azure CLI version.
- script: pip install --pre azure-cli --extra-index-url https://azurecliprod.blob.core.windows.net/edge
  displayName: 'upgrade azure cli'

- script: az --version
  displayName: 'Show Azure CLI version'

- script: az extension add -n azure-devops
  displayName: …
Run Code Online (Sandbox Code Playgroud)

azure azure-cli azure-devops azure-pipelines

3
推荐指数
1
解决办法
4669
查看次数