Monorepo + microservices + bitbucket + azure devops

I’m trying to figure our how to automatically detects projects/quality gates from each CI/CD pipeline within my mono repo but i can’t found the way to do it. When i’m trying to set the integration between SonarCloud and AzureDevOps in my CI/CD pipeline i’m asked to hardcode the values for projectKey and projectName. When i do so all my code from all pipelines is analysed in the main sonarcloud project and i can’t check analysis for separate services.

Is anybody here able to help me or at least point me correct direction ?

  • ALM used - Bitbucket Cloud
  • CI system used - Azure DevOps
  • Languages of the repository - mainly .net core
  • Monorepo with multiple microservices that have separate CI/CD pipelines set all in .net core
  • Scanner command -
 projectfilepath: ''

- task: SonarCloudPrepare@1
    SonarCloud: 'SonarCloud'
    organization: '<organization>'
    scannerMode: 'MSBuild'
    projectKey: '<project key>'
    projectName: '<project name>'    
- task: DotNetCoreCLI@2
    command: 'build'
    projects: '${{ parameters.projectfilepath }}'
- task: SonarCloudAnalyze@1
  continueOnError: true
- task: SonarCloudPublish@1
    pollingTimeoutSec: '300'

Hi @igorbienkowski , welcome to the community.

Not sure to understand your use case exactly here :

You said that each of your microservices have their own CI/CI pipeline : Does that mean that 1 microservice = 1 project (and also 1 SonarCloud project) ?


@mickaelcaro this is exactly what i would like to achieve but automatically as i was doing it in sonarqube. In prepare step i was passing variable and sonarqube was automatically creating projects for each pipeline but from your documentation it seems that with sonarcloud all projects needs to be manually created ? we have tens of microservices this means we’ll spend hours on setting it all up ?

Unfortunately yes, we are deprecated the automatic creation for projects.

However, our UI allow you to import a “MonoRepo”. You will need to add an organization name and a token, we will list the Azure DevOps projects / repositories available, and on the bottom right part of the list, you can setup a monorepo, so then you can create as much projects as possible for one selected repository.


I was worried that this will be the answer to my question :confused: is there any good reason why you’ve deprecated the automatic option ?

We want our users to benefit from the best experience possible when integrating with DevOps Platforms (Azure DevOps, GitHub, …). When creating projects manually, features are missing compare to “binding” your repository to a SonarCloud project, that’s one of the main reason.

well setting up 50 projects manually is definitely not something I would describe as ‘the best experience’. But anyway, thank you for honest answer, thankfully I need to go through this process only once :slight_smile:

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