Unable to set token from Azure DevOps

(Bas Stottelaar) #1

From the Azure DevOps prepare task, I set sonar.pullrequest.vsts.token.secured to a working value. However, once the scan is completed, it doesn’t decorate a pull-request.

Looking at the Background Tasks -> Scanner Context, I do see sonar.pullrequest.vsts.token.secured=*******, but Background Tasks -> Show Warnings tells me ‘Pull request decoration did not happen because the token is missing. Please set it in the project settings.’

I expect this to work via Azure DevOps, since I don’t want to set this key via the project settings, as it requires me to set this key for 100+ project (I can create a task group in Azure DevOps to simplify a lot of work so others don’t have to).

Any idea on how to get this working?

(Colin Mueller) #2


This value needs to be set in the project settings, rather than through an analysis parameter.

If you need to automate this somehow, you might find the POST api/settings/set Web API useful.

You might also want to vote on MMF-1478 to have settings available at the organization level. :slight_smile:


Global setting for branch patterns
(Bas Stottelaar) #3

Thanks Colin, I already suspected that.

However, from the UI it isn’t really clear: it lists sonar.pullrequest.vsts.token.secured in the project settings, so I suspected this to work.

I’ll take a look at the API approach.