在 Azure Pipelines YAML 中,可以指定作业运行的环境。
jobs:
- deployment: Deploy
displayName: Deploy
environment: $(environment)
Run Code Online (Sandbox Code Playgroud)
将新值传递给管道应该会自动在 DevOps 中创建环境。
但是,我最近在尝试部署到新环境时遇到了此错误:
作业部署:找不到环境 [环境名称]。该环境不存在或尚未获得使用授权。
我手动创建环境后,管道部署成功。
是否有任何配置或我缺少的东西可以允许自动创建环境?
continuous-deployment azure-pipelines azure-pipelines-yaml cicd
我尝试在 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.
Run Code Online (Sandbox Code Playgroud)
代码:
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
Run Code Online (Sandbox Code Playgroud)
该文件被推送到触发构建的分支的存储库。$(Pipeline.Workspace) …
azure azure-powershell azure-devops azure-pipelines azure-yaml-pipelines