简体   繁体   English

TFS2017的401未经授权的Sonarqube分析

[英]401 Unauthorized Sonarqube Analysis with TFS2017

I setup a SonarQube server and included the BuildTask Steps in the TFS2017 Build process. 我设置了SonarQube服务器并将BuildTask步骤包括在TFS2017生成过程中。 TFS is an on-premise setup. TFS是一种本地设置。

On "Complete SonarQube analysis" build step i get the following error: 在“ Complete SonarQube analysis”构建步骤中,出现以下错误:

2017-01-30T08:54:30.7388183Z 09:54:30.676  Post-processing succeeded.
2017-01-30T08:54:32.1607278Z ##[error]System.Management.Automation.CmdletInvocationException: {"err_code":401,"err_msg":"Unauthorized"} ---> System.Net.WebException: Der Remoteserver hat einen Fehler zurückgegeben: (401) Nicht autorisiert.
2017-01-30T08:54:32.1607278Z    bei Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
2017-01-30T08:54:32.1607278Z    bei Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
2017-01-30T08:54:32.1607278Z    --- Ende der internen Ausnahmestapelüberwachung ---
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-30T08:54:32.1607278Z    bei System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
2017-01-30T08:54:32.1607278Z    bei Microsoft.TeamFoundation.DistributedTask.Handlers.LegacyVSTSPowerShellHost.VSTSPowerShellHost.Main(String[] args)
2017-01-30T08:54:32.1763500Z ##[error]LegacyVSTSPowerShellHost.exe completed with return code: -1.
2017-01-30T08:54:32.1763500Z ##[section]Finishing: Complete the SonarQube analysis

As the analysis finished, I assume this is some kind of logging done by SonarQube afterwards. 分析完成后,我假设这是SonarQube之后进行的某种日志记录。

Build Agent is installed on server A, SonarQube installed on server B. The "prepare step" Build Task finishes without errors so I assume, the basic SonarQube Setup is ok. Build Agent安装在服务器A上,SonarQube安装在服务器B上。“准备步骤”构建任务完成且没有错误,因此我认为基本的SonarQube安装程序正常。 I installed SonarQube 5.6.5 LTS and the Sonar User provided in the SonarQube.Analysis.xml is the default admin/admin user. 我安装了SonarQube 5.6.5 LTS,并且SonarQube中提供了Sonar用户.Analysis.xml是默认的admin / admin用户。

Any suggestions? 有什么建议么?

The build tasks do not use the authentication properties in SonarQube.Analysis.xml, you need to specify the authentication token in the SonarQube endpoint in TFS: https://docs.sonarqube.org/display/SCAN/SonarQube+Endpoint 构建任务不使用SonarQube.Analysis.xml中的身份验证属性,您需要在TFS的SonarQube端点中指定身份验证令牌: https ://docs.sonarqube.org/display/SCAN/SonarQube+Endpoint

And here is an article about how to obtain the token from SonarQube: https://docs.sonarqube.org/display/SONAR/User+Token 以下是有关如何从SonarQube获取令牌的文章: https ://docs.sonarqube.org/display/SONAR/User+Token

Dont' forget to comment the sonar.login and sonar.password properties again in the SonarQube.Analysis.xml if you uncommented those in the first place. 如果您首先没有评论注释,请不要忘记在SonarQube.Analysis.xml中再次评论sonar.login和sonar.password属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM