"No repositories found for this organization"

Hi everyone.

We’ve just gotten started on our 14-day SonarCloud trial period and have followed the setup guide for Azure Devops but we’re running into issues. Our private organization has been imported and connects correctly (as can be verified by following the link saying that we’re bound to Azure Devops) but when trying to find a repo in the Analyze Projects screen we get the “no repositories found for this organization” message.

We’ve tried elevating the permissions of the user that created the PAT but it hasn’t made any difference. The azure conditional access policy is Disabled, as per the guide.

I’ve not been able to find much information about this particular issue, so it feels like it’s something elementary we’re missing. What else might be causing a connection issue between our Azure DevOps and SonarCloud? Any tips on things to try?

Thanks in advance!

The root cause of the issue was found, the user who created the PAT (a service account made for the task) was set to the Stakeholder access type where it should have had Basic instead. Changing the user type gave access to the repositories.
Should someone else face the same issue in the future, they can try the following:

Curl azure devops API with their AzureDevOps organization name to get the list of projects, and then for each projects, fetch the list of the repositories. If nothing is returned while fetching the repository list, it means there is something wrong on AzureDevops configuration and this is why SonarCloud can’t access the repositories.

Fetch projects: https://dev.azure.com/{AzureDevopsOrg}/_apis/projects?api-version=6.0
Fetch repositories: https://dev.azure.com/{AzureDevopsOrg}/{projectId}/_apis/git/repositories?api-version=6.0

The following command can be used

curl --location --request GET '<URL>' \
--header 'Authorization: BASIC <B64_PAT>'

And the documentation to generate the B64_PAT is here, section “use a PAT”. The PAT generated for SonarCloud should be used.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.