-1

Can anybody explain me how to get this working?
I have a pipeline which uses a job template and that uses a steps template.

I can set the variable

variables:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)

or

variables:
      system_accesstoken: $(System.AccessToken)

in the starting pipeline and in the steps template but it doesn't work.
(according to this question)

I keep getting:

[error]'Allow Scripts to Access OAuth Token' must be enabled.

If I set it through the visual designer and view the yaml or export the pipeline, I don't find any reference to setting 'Allow OAuth...'.

This is also not helpful for a yaml based pipeline...

This is the task that needs the token:

- task: bool.fetch-build-artifact.fetch-build-artifact-task.fetch-build-artifact@3
    displayName: 'Fetch'
    inputs:
      project: '[omitted]'
      buildDefinitionId: 159
      artifactName: drop.develop
    env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)
Community
  • 1
  • 1
grmbl
  • 2,514
  • 4
  • 29
  • 54

1 Answers1

3

Be sure to check if you're using
- task: DownloadBuildArtifacts@0
and not
bool.fetch-build-artifact.fetch-build-artifact-task.fetch-build-artifact@3

What I ended up using:

- task: DownloadBuildArtifacts@0
    displayName: 'Download Build Artifacts'
    inputs:
      buildType: specific
      project: '[project GUID omitted here]'
      pipeline: 159
      artifactName: drop.develop
    env:
      SYSTEM_ACCESSTOKEN: $(System.AccessToken)
grmbl
  • 2,514
  • 4
  • 29
  • 54