【发布时间】:2022-01-06 14:47:18
【问题描述】:
我正在尝试在 Azure Yaml Pipelines 中运行 PowerShell 脚本,但出现此错误:
##[error]The term 'D:\a\1\s\myPowershellFile.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
代码:
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(myEnvironment)
pool:
vmImage: 'windows-latest'
strategy:
runOnce:
deploy:
steps:
- task: AzurePowerShell@5
displayName: 'Run Powershell script'
inputs:
azureSubscription: $(azureConnectionName)
scriptType: filePath
scriptPath: './myPowershellFile.ps1'
azurePowerShellVersion: latestVersion
文件被推送到触发构建的分支的 repo。我还尝试使用$(Pipeline.Workspace) 和$(Build.SourcesDirectory) 显式引用路径。版本 4 也不起作用。根据the docs,这应该可以工作!
【问题讨论】:
标签: azure azure-devops azure-pipelines azure-powershell azure-yaml-pipelines