'Use a secure file from another azure pipeline library

I have the following yaml setup to download a secure file. The codesignfile.pfx is in a different project in Azure Devops. I have followed the instruction to allow the current's build service access by setting it as a user for that file. How do I reference the file from another pipeline's library in yaml? I think that is what I'm messing up.

I'm still getting the error:

The pipeline is not valid. Job Job: Step CodeSign input secureFile references secure file CodeSignfile.pfx which could not be found. The secure file does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz. Job Job: Step codesigning input secureFileId references secure file $(CodeSign.secureFilePath) which could not be found. The secure file does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."<


# Download a secure file to the agent machine
- task: DownloadSecureFile@1
  name: CodeSign # The name with which to reference the secure file's path on the agent, like $(mySecureFile.secureFilePath)
  displayName: 'Download Certificate'
  inputs:
    secureFile: 'codesignfile.pfx'
    #retryCount: 5 # Option
#sign our msi
- task: codesigning@2
  inputs:
    secureFileId: '$(CodeSign.secureFilePath)'
    signCertPassword: '$(Certificate Password)'
    files: '$(Build.SourcesDirecotry)/Product-Installer/Installer/bin/Release/*.exe'
    timeServer: 'http://timestamp.digicert.com'
    hashingAlgorithm: 'SHA256'


Solution 1:[1]

I'm afraid you can't use the secure file stored in another project in the pipeline.

Currently secure files are restricted to use at the Project level, we cannot use secure files across projects.

But your requirement is valuable. Here is a suggestion ticket with the same requirements: Azure DevOps Secure Files - Central store, shared between projects?

You can vote it and add comment in this suggestion ticket.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Lu-MSFT