gpt4 book ai didi

Azure PowerShell 任务找不到文件路径

转载 作者:行者123 更新时间:2023-12-02 23:15:12 26 4
gpt4 key购买 nike

我尝试在 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

该文件被推送到触发构建的分支的存储库。我还尝试使用 $(Pipeline.Workspace)$(Build.SourcesDirectory) 显式引用路径。版本 4 也不起作用。根据the docs这应该可以工作!

最佳答案

经过更多研究,我发现 this article这表示不会自动下载文件以进行部署作业。我添加了此步骤,解决了问题!

-结账:自助

关于Azure PowerShell 任务找不到文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70160006/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com