0

I have an Azure DevOps pipeline and I want to tag the Azure Git repository

task: AssembyInfoReader@2
 displayName: Set Version numbers
 inputs:
   searchPattern: 'JLReyLibrary/Properties/GlobalAssemblyInfo.cs'

To get the assembly info variables.

Then this task causes an error:

task: GitTag@2
 displayName: Tag Repo to $(AssemblyInfo.AssemblyInformationVersion)
 inputs:
   tag: '$(AssemblyInfo.AssemblyInformationalVersion)'
   forceTagCreation: true
##[error]OAuth token not found. Make sure to have 'Allow Scripts to Access OAuth Token' enabled in the build definition.

How do I set the OAuth token?

Clarification

I tried what was suggested below.

Now I have the following questions.

  • How do I get the OAuth token?
  • How do I get it in the env: Systems_AccessToken: $(System.AccessToken)

I have found the `DevOps->Organizational Settings->OAuth Configurations

  • Where do I find a description of the fields in the setting?

I am still getting the following error message:

Allow Scripts to Access OAuth Token

jl-rey
  • 1
  • 3
  • Does this answer your question? [How to allow scripts to access OAuth token from yaml builds](https://stackoverflow.com/questions/52837980/how-to-allow-scripts-to-access-oauth-token-from-yaml-builds) – Matt Jul 16 '20 at 17:43

1 Answers1

0

You need to add this to the task:

env:
  System_AccessToken: $(System.AccessToken)

So, in your case:

- task: GitTag@2
  displayName: Tag Repo to $(AssemblyInfo.AssemblyInformationVersion)
  inputs:
    tag: '$(AssemblyInfo.AssemblyInformationalVersion)'
    forceTagCreation: true
  env:
     System_AccessToken: $(System.AccessToken)
Shayki Abramczyk
  • 36,824
  • 16
  • 89
  • 114