Azure DevOps access token is not valid Reasons

Good morning,

ALM used Azure DevOps
CI system used Azure DevOps
Scanner command used when applicable

Sonar error
Azure DevOps access token is not valid Reasons: The token does not have the required permissions (code: read-write)

Azure DevOps pipeline error
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=toroinvestments_Toro.GraphQLApi&pullrequestKey=17676 : {“errors”:[{“msg”:“Unable to find the pullrequest with key \u002717676\u0027”}]}

=================
Sonar Analysis

View raw log

INFO: Load project branches
INFO: Load project branches (done) | time=499ms
INFO: Check ALM binding of project 'toroinvestments_Toro.GraphQLApi'
INFO: Detected project binding: BOUND
INFO: Check ALM binding of project 'toroinvestments_Toro.GraphQLApi' (done) | time=464ms
INFO: Load project pull requests
INFO: Load project pull requests (done) | time=484ms
INFO: Load branch configuration
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 29.856s
INFO: Final Memory: 20M/70M
INFO: ------------------------------------------------------------------------
##[error]ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '17676'
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=toroinvestments_Toro.GraphQLApi&pullrequestKey=17676 : {"errors":[{"msg":"Unable to find the pullrequest with key \u002717676\u0027"}]}
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
ERROR: Error during SonarScanner execution
ERROR: Could not find the pullrequest with key '17676'
ERROR: Caused by: Error 404 on https://sonarcloud.io/api/alm_integration/show_pullrequest?project=toroinvestments_Toro.GraphQLApi&pullrequestKey=17676 : {"errors":[{"msg":"Unable to find the pullrequest with key \u002717676\u0027"}]}
ERROR: 
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
##[error]The process '/home/vsts/work/_tasks/SonarCloudAnalyze_ce096e50-6155-4de8-8800-4221aaeed4a1/1.38.0/sonar-scanner/bin/sonar-scanner' failed with exit code 2
Finishing: Sonar Analysis`

Well… you better provide a token in SonarCloud that has Read/Write Code access :smiley:

Or is the issue that you believe you already are?

Solution:

Azure DevOps
1- A new “New Token” was created within Azure DevOps a new personal access token.

SonarCloud
1- Organization menu: Go to administration
2- Scroll down to: Azure DevOps Connectivity Management
3- Paste the Azure DevOps Personal token in the Azure DevOps Connectivity Management field
4- Click the Update button

1 Like