未经授权:由于凭据无效,访问被拒绝。请检查SonarQube SonarScanner.MsBuild.exe中的身份验证参数

问题描述 投票:0回答:1

我正在尝试设置一个测试环境来试验 SonarQube。这是我迄今为止采取的步骤:

  • 下载并安装 SonarQube。我可以运行它,导航到 http://localhost:9000

  • 在 Azure DevOps 中为存储库创建了一个新项目。声纳能够连接到它、读取存储库等。

  • 下载了最新版本的 SonarScanner.MsBuild 运行程序。解压并将路径放入%PATH%环境变量中

  • 在声纳中,我创建了一个新的用户令牌并放入运行程序文件夹中的

    SonarQube.Analysis.xml

    <Property Name="sonar.host.url">http://localhost:9000</Property>
    <Property Name="sonar.login">admin</Property>
    <Property Name="sonar.password">sonar</Property>
    <Property Name="sonar.token">squ_7b.......601</Property>
    
  • 回到 Sonar,我创建了一个新的本地运行。

  • 选择选项

    Generate a project token
    并单击下一步

  • 然后 Sonar 要求我运行以下命令:

SonarScanner.MSBuild.exe begin /k:"TEST_PROJECT-local" /d:sonar.host.url="http://localhost:9000" /d:sonar.token="sqp_ec60....a7e1"

我可以看到该项目代币是由 Sonar 创建的。但是当我运行它时,我收到以下错误:

SonarScanner for MSBuild 5.13
Using the .NET Framework version of the Scanner for MSBuild
Pre-processing started.
Preparing working directories...
09:15:30.629  Updating build integration targets...
09:15:30.797  Unauthorized: Access is denied due to invalid credentials. Please check the authentication parameters.
09:15:30.8  Pre-processing failed. Exit code: 1

我错过了什么?

.net sonarqube sonar-runner
1个回答
0
投票

尝试删除这两行

<Property Name="sonar.login">admin</Property>
<Property Name="sonar.password">sonar</Property>

来自您的

SonarQube.Analysis.xml
文件。

我遇到了同样的问题,并且能够通过这样做解决它。我认为这个问题与扫描仪在存在登录名和密码时尝试使用它们有关,但我们实际上应该只使用令牌进行身份验证。

© www.soinside.com 2019 - 2024. All rights reserved.