如何解决 Azure DevOps 管道中的可信签名问题

问题描述 投票:0回答:1

我正在尝试在 Azure DevOps 中设置 Azure 可信签名。当我去添加一个步骤时,唯一显示为可用的任务表示它将在几个月内被弃用。无论如何,我尝试了它,但随后收到错误消息,指出该任务正在尝试使用交互模式。我的代理是自托管的,但我不明白为什么要为 CI/CD 管道启用交互模式。

我该如何解决这个问题?找到新任务是否有秘诀或者是否有解决错误的方法?

(更新:我通过搜索 TrustedSigning 而不是 Trusted Signing 找到了较新的任务,但错误仍然存在。)

2024-04-23T22:45:17.2644731Z ##[section]Starting: TrustedSigning
2024-04-23T22:45:17.2747906Z ==============================================================================
2024-04-23T22:45:17.2748384Z Task         : Trusted Signing
2024-04-23T22:45:17.2748665Z Description  : This task enables users to sign their files with the Trusted Signing service.
2024-04-23T22:45:17.2748903Z Version      : 0.3.16
2024-04-23T22:45:17.2749219Z Author       : Microsoft
2024-04-23T22:45:17.2749388Z Help         : 
2024-04-23T22:45:17.2749553Z ==============================================================================
2024-04-23T22:45:21.3237488Z ##[error]Exception calling "ShouldContinue" with "2" argument(s): "Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available."
2024-04-23T22:45:21.3493399Z ##[section]Finishing: TrustedSigning
azure azure-devops code-signing trusted-signing
1个回答
0
投票

根据您的问题,您正在使用可信签名任务。它提到该任务使用 DefaultAzureCredential 作为 Azure 身份验证的主要方法。 EnvironmentCredential 变量作为输入公开,然后设置为任务范围的环境变量。可以使用任务输入禁用 DefaultAzureCredential 支持的每种凭据类型。因此,请检查您是否提供了所需的身份验证信息。

这是一个相同错误故障排除文档供您参考。它提到此错误可能是由于未安装 PowerShell NuGet 包提供程序引起的。默认情况下,Windows PowerShell 不安装这些组件。要解决此问题,您可以在代理上安装 NuGet 包提供程序或添加任务以将其安装在管道中。

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Write your PowerShell commands here.
      
      if ($Null -eq (Get-PackageProvider -Name NuGet -ErrorAction Ignore)) {
          Install-PackageProvider -Name NuGet -Force -Scope CurrentUser;
      }
      
      if ($Null -eq (Get-InstalledModule -Name PowerShellGet -MinimumVersion 2.2.1 -ErrorAction Ignore)) {
          Install-Module PowerShellGet -MinimumVersion 2.2.1 -Scope CurrentUser -Force -AllowClobber;
      }
© www.soinside.com 2019 - 2024. All rights reserved.