Assistance Needed with Empty Analysis Results in Azure Pipeline Integration

Hello SonarCloud Community,

I am encountering an issue with SonarCloud analysis in my Azure DevOps pipeline. Despite successful pipeline execution, the analysis results on SonarCloud appear empty. I would greatly appreciate any guidance or suggestions to resolve this.

Pipeline Overview:

  • I have set up a pipeline in Azure DevOps for a project that involves IoT Edge development.
  • The pipeline includes steps for SonarCloud code analysis, IoT Edge module build and push, and artifact publishing.

Key Configuration Details:

  • SonarCloud service connection is set up in Azure DevOps.
  • cliProjectKey and cliProjectName are configured to match the project in SonarCloud.
  • sonar.inclusions is set to **/*.cs, targeting C# files.
  • Source path for analysis is set under cliSources as Modules.

Issue Description:

  • The pipeline completes without errors, but the SonarCloud analysis shows no data.
  • I have verified the paths and patterns for source code inclusions.

I’ve checked the pipeline logs and no clear errors or warnings related to SonarCloud.

I am wondering if there might be a specific configuration or step that I’m missing or if there’s a known issue with such a setup. Any insights, suggestions, or guidance would be immensely helpful.

Thank you in advance for your time and assistance.

  name: Azure Pipelines
  demands: java

- task: SonarSource.sonarcloud.####.SonarCloudPrepare@1
  displayName: 'Prepare analysis on SonarCloud'
    SonarCloud: 'sonarcloud'
    organization: '#####'
    scannerMode: CLI
    configMode: manual
    cliProjectKey: 'Factory_Edge'
    cliProjectName: 'Factory_Edge'
    cliSources: Modules
    extraProperties: |
  continueOnError: true

- bash: 'sudo pip install -U iotedgedev pyOpenSSL==21.0.0 cryptography==38.0.4'
  displayName: 'Bash Script'

- task: AzureIoTEdge@2
  displayName: 'Azure IoT Edge - Build module images'
    templateFilePath: Modules/deployment.template.json

- task: AzureIoTEdge@2
  displayName: 'Azure IoT Edge - Push module images'
    action: 'Push module images'
    azureSubscriptionEndpoint: '#######'
    azureContainerRegistry: '{"loginServer":""}'
    templateFilePath: Modules/deployment.template.json

- task: PublishBuildArtifacts@1
  displayName: 'Publish Artifact: modules'
    ArtifactName: modules

- task: SonarSource.sonarcloud.######.SonarCloudAnalyze@1
  displayName: 'Run Code Analysis'
  continueOnError: true

Hi Filipe,

Can you walk me through what your project is made of?

You seem to be wanting to analyze .NET code. If that is the case, you need to do the following:

  1. Set the scanner mode to ‘MSBuild’

  2. Actually invoke the build command between the prepare and analyze tasks
    For example, for modern .NET projects that could be

  • task: DotNetCoreCLI@2
    displayName: ‘Build solution’
    command: ‘build’
    projects: ‘**/*.sln’
  1. Optionally, to benefit from pull request quality gate and decorations, use the task SonarCloudPublish after the analysis:
  • task: SonarCloudPublish@1
    displayName: ‘Publish results on build summary’
    pollingTimeoutSec: ‘300’

Let me know if this helps you get the analysis up and running, or if we need to dig deeper.


Hi Denis,

Thank you for your guidance on analyzing .NET code with SonarCloud. I’d like to provide some context about the project I’m working on to clarify the issue I’m facing.

The project in question is an Azure IoT Edge solution(What is Azure IoT Edge | Microsoft Learn), primarily written in C#. It’s structured into several .csproj files, each representing a distinct module within the solution. Given this architecture, we’re dealing with multiple modules encapsulated within individual project files, rather than a single, consolidated solution file.

I have already attempted to implement the build process using the tasks you mentioned. Additionally, I utilized the following steps:

- task: MSBuild@1
  displayName: 'Build solution **/*.sln'
    restoreNugetPackages: true
  continueOnError: true

However, I encountered issues in getting these tasks to effectively analyze and build the entire project structure as intended. It seems like the MSBuild task doesn’t fully recognize or handle the modular nature of the Azure IoT Edge solution, which is causing the analysis to fail or be incomplete.

Have you, or anyone else in the community, successfully set up SonarCloud analysis for similar Azure IoT Edge projects? Any insights or recommendations for handling the complexities of this project structure would be greatly appreciated.

Looking forward to your thoughts or any further advice you might have.

Best regards,

Hi Filipe, Happy New Year!

I have not yet encountered the Azure IoT Edge solution.
Can you walk me through how you build the project on your machine and in CI?