megha
megha

Reputation: 833

Azure DevOps invoke rest api task authorization failing

I am using invoke rest api task in pipeline

enter image description here

I have saved Azure DevOps Pat token in variable with name system.AccessToken

Its giving error unauthorized

I also tried converting PAT token to base64 and then saving in variable. Its still showing same error.

What value do I need to provide for system.AccessToken ?

enter image description here

Upvotes: 0

Views: 1356

Answers (1)

Walter
Walter

Reputation: 3058

You do not need to add PAT token to your variables. System.AccessToken is a special variable that carries the security token used by the running build.

In addition, you are using Invoke Rest API task in an agentless job, so you also don't need to set "allow scripts to access the OAuth token" option.

Here is my sample and it works well:

1.Create service connection:

enter image description here

2.Configuration of Invoke REST API task:

enter image description here

Upvotes: 1

Related Questions