Problem
The Personal Access Token created in Azure DevOps is not valid for authentication.
Diagnosis
Jira admins will see a Not authorized error (with the following full error) when connecting to Azure DevOps with a Personal Access Token if the token was created for a specific Azure DevOps organization:
Technical info: Error:
2019-07-08 12:21:09,997 http-nio-8080-exec-436 ERROR sfj 741x4276982x1 a7oa8 192.168.143.212 /rest/gitplugin/1.0/trackedfolders/scan/4994-Bpv7dj9zmeyFAAf6 [c.b.j.g.rest.exceptionmappers.WrappedIntegrationAPIExceptionMapper] Rest API has thrown exception.
com.bigbrassband.jira.git.exceptions.external.WrappedMicrosoftAPIException: External service error
at com.bigbrassband.jira.git.services.integration.microsoft.MicrosoftApi.getRepositoriesMS(MicrosoftApi.java:134)
at com.bigbrassband.jira.git.services.integration.microsoft.MicrosoftApi.getRepositories(MicrosoftApi.java:93)
at com.bigbrassband.jira.git.services.integration.microsoft.MicrosoftApiService.scan(MicrosoftApiService.java:132)
at com.bigbrassband.jira.git.services.integration.microsoft.MicrosoftApiService.fastScan(MicrosoftApiService.java:137)
at com.bigbrassband.jira.git.services.async.ScanTrackedRepoTask.run(ScanTrackedRepoTask.java:61)
at com.bigbrassband.jira.git.services.async.AsyncProcessorImpl$AsyncTaskWrapper.run(AsyncProcessorImpl.java:114)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: com.bigbrassband.common.indexer.sources.clients.RequestException: Microsoft https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0 Unauthorized (401)
at com.bigbrassband.common.indexer.sources.clients.MicrosoftClient.runRequest(MicrosoftClient.java:288)
at com.bigbrassband.common.indexer.sources.clients.MicrosoftClient.callSingleApi(MicrosoftClient.java:239)
at com.bigbrassband.common.indexer.sources.clients.MicrosoftClient.getUserId(MicrosoftClient.java:173)
at com.bigbrassband.jira.git.services.integration.microsoft.MicrosoftApi.getRepositoriesMS(MicrosoftApi.java:125)
... 10 more
Solution
Azure DevOps Personal Access Tokens must be created using the All accessible organizations in the Organization dropdown. Additionally – the token must either have Full access scope or Code: Read & Write (as shown below). Minimum requirement is Code: Read.
-
Create new Personal Access Token:
-
Copy token:
-
Verify token uses All accessible organizations, has sufficient scopes, is not expired and is active:
-
Paste newly created token:
-
Click Connect.
If you still have a question – reach out to our Support Desk or email us at [email protected].
More articles about troubleshooting, workarounds and solutions
Why I am getting the error, “git-upload-pack not permitted”?
Cannot auto-deploy some tracked repositories: Specified origin is incorrect or not supported
Connection Reset when Accessing the Database
“Dangerous use of multiple connections” error on local database
Duplicate entry 0 for key PRIMARY exceptions in log
Error while reindexing – Java heap space / Object too large, rejecting the pack
Error creating git branches and also using NFS
Fix performance issues for nested cloned repositories with enabled Git Service Permissions mode
Fixing reindex issues using Indexing Queue Viewer
Gitolite integration: Why the Git integration app not see the master branch?
Health Check: Database Collation
Indexing error – Too many open files
Installation fails when installing manually
Jira index error: IndexNotFoundException: no segments* file found
Malformed input or input contains unmappable characters
Personal access token failing Azure DevOps integration with Not Authorized error (this page)
Problems with shared home on Azure Storage
Pull request index error: org.json.JSONException
Repositories missing from Azure DevOps integration
“Service proxy has been destroyed” exceptions in log
SQLException ‘Incorrect string value’ in merge requests
SSH key file format is invalid
TFS – Not authorized exception when Jira works thru proxy
Unexpected exception parsing XML document from URL error in log
Why don’t I see the Create Branch or Pull Request features?