YAML 管道:部署与作业、ScriptPath 和 csmFile 不工作

YAML pipeline: Deployment vs Jobs, ScriptPath and csmFile not working

我有Jobs working correctly in a YAML pipeline but when I changed it to Deployment Job,路径不工作。

jobs:
  - job: InfrastructureAsCodeDeployment
    pool:
        name: Azure Pipelines
        vmImage: windows-2019
    steps:
    - task: "AzurePowerShell@2"
      displayName: 'Azure PowerShell script: Remove Keyvault'
      inputs:
        azureSubscription: 'Connection name'
        ScriptType: 'FilePath'
        ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
        ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
        azurePowerShellVersion: 'LatestVersion'
      continueOnError: true

进入部署作业后:-

  jobs:
  - deployment: InfrastructureAsCodeDeployment
    pool:
        name: Azure Pipelines
        vmImage: windows-2019
    environment: 'DEV'
        strategy:
          runOnce:
            deploy:
              steps:
              - task: "AzurePowerShell@2"
                displayName: 'Azure PowerShell script: Remove Keyvault'
                inputs:
                  azureSubscription: 'Connection name'
                  ScriptType: 'FilePath'
                  ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
                  ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
                  azurePowerShellVersion: 'LatestVersion'
                continueOnError: true

已尝试将 'System.DefaultWorkingDirectory' 添加到 Deployment,但仍然无效。

开始时需要一个额外的步骤

steps:
- checkout: self 

看起来像这样

  jobs:
  - deployment: InfrastructureAsCodeDeployment
    pool:
        name: Azure Pipelines
        vmImage: windows-2019
    environment: 'DEV'
        strategy:
          runOnce:
            deploy:
              steps: 
              - checkout: self 
              - task: "AzurePowerShell@2"
                displayName: 'Azure PowerShell script: Remove Keyvault'
                inputs:
                  azureSubscription: 'Connection name'
                  ScriptType: 'FilePath'
                  ScriptPath: 'Powershell Scripts/IAC/kv-RemoveExistingSoftDeleted.ps1'
                  ScriptArguments: '-vaultName $(keyVaultName) -location "$(location)"'
                  azurePowerShellVersion: 'LatestVersion'
                continueOnError: true

不幸的是,文档没有说明这一点。 但是我在与作业管道(部署管道没有可视化步骤)进行比较时发现了这一点。