Search code examples
azureazure-devopscode-signingtrusted-signing

How to solve a problem with Trusted Signing in an Azure DevOps Pipeline


I'm trying to set up Azure Trusted Signing in Azure DevOps. When I went to add a step, the only task that showed as available said it's being deprecated in a couple months. I tried it anyways but then got an error saying the task was trying to use interactive mode. My agent is self hosted but I don't see why I'd want to enable interactive mode for a CI/CD pipeline.

How can I resolve this? Is there a secret to finding the new task or is there a fix to the error?

(Update: I found the newer task by searching for TrustedSigning instead of Trusted Signing but the error remains.)

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

Solution

  • According to your question, you are using the Trusted Signing task. It mentions that the Task uses DefaultAzureCredential as the primary method of authentication to Azure. The EnvironmentCredential variables are exposed as inputs and then set to Task-scoped environment variables. Each credential type supported by DefaultAzureCredential can be disabled using the Task inputs. So please check if you have provided the required Authentication information.

    This is a same error Troubleshooting document for your reference. It mentions this error may be caused by the PowerShell NuGet package provider not being installed. By default, Windows PowerShell does not have these components installed. To resolve this issue, you can install the NuGet package provider on the agent or add a task to install it in the pipeline.

    - 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;
          }