Personal access token - pull request VSTS

Hi,

i use sonarcloud with Azure devops for control pullrequest.
So i have configured Personal access token in project configuration to activate this.
It’s possible to have a configuration for all project or inject this PAT by API ?

Thanks

Hello Xavier :wink: @xtop-Nexity

This is not possible to add the same PAT for all projects at once…
but you can use the Web API to inject the PAT for each project programmatically. See: https://sonarcloud.io/web_api/api/settings

Specifically you should do something like: https://sonarcloud.io/api/settings/set?key=sonar.pullrequest.vsts.token.secured&component=<projectKey>&value=<yourPAT>

You may notice in the API docs that the component parameter is defined as optional but if you don’t specify it for the PAT setting I am no sure of what would be the result.

Regards

1 Like