Azure Devops integration with Sonarcloud - cannot find quality profile

Repo: Azure Devops
CI system: Azure DevOps
Language: .NET

I am trying to setup repository scanning with Azure Devops pipeline. However I cannot see the option to set the “organization” parameter, as per the documentation.

The error I receive also hints that this is the cause of the issue when it attempts to retrieve the quality profile:

11:43:15.818 Fetching analysis configuration settings…

##[error]11:43:16.013 Failed to request and parse 'https://sonarcloud.io/api/qualityprofiles/search?project=<>': Response status code does not indicate success: 400 ().

11:43:16.013 Failed to request and parse 'https://sonarcloud.io/api/qualityprofiles/search?project=<>': Response status code does not indicate success: 400 ().

##[error]Unhandled exception.

##[error]System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 ().

When I put the api URL into a browser I get the following response:

{“errors”:[{“msg”:“The \u0027organization\u0027 parameter is missing”}]}

I have tried adding it as a parameter in a number of different formats but to no avail:
YAML file currently looks like this:

trigger:

  • feature/sonarCloud_v2

pool:
vmImage: ubuntu-latest

steps:

  • checkout: self
    fetchDepth: 0

  • task: NuGetToolInstaller@1
    displayName: 'Use NuGet ’

  • task: NuGetCommand@2
    displayName: ‘NuGet restore’
    inputs:
    vstsFeed: ‘4845e524-5efd-484a-b3b7-88b0a4d933ab/26f090b2-bbb8-42bb-8a7d-20f4beab0cab’
    noCache: true

  • task: SonarQubePrepare@5
    inputs:
    SonarQube: ‘SonarQube (Cloud)’
    scannerMode: ‘MSBuild’
    projectKey: ‘’
    projectName: ‘’
    extraProperties: |
    # Additional properties that will be passed to the scanner,
    # Put one key=value per line, example:
    # sonar.exclusions=**/*.bin
    sonar.organization=xyz

I managed to get a test repo working fine but cannot get our main source code repo to scan.
Any help much appreciated.

Thanks

Hi,

Take a look at the docs. I think you’re using the wrong task. Should be something like:

- task: SonarCloudPrepare@1
 inputs:
   SonarCloud: 'SonarCloud'
   organization: 'mySonarCloudOrganization'
   scannerMode: 'MSBuild'
   projectKey: 'myRepo_myProject1'

 
HTH,
Ann