Azure DevOps 客户端 SDK:使用 TestManagementHttpClient.GetTestResultsByBuildAsync2 会引发身份验证错误
我正在使用 用于 Azure DevOps 的 .NET 客户端库 从构建尝试中获取测试结果。以下内容会引发身份验证错误,Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You 无权访问 https://dev.azure.com。
var testClient = connection.GetClient<TestManagementHttpClient>();
var testResults = await testClient.GetTestResultsByBuildAsync2(
project: project,
buildId: ID);
我正在使用范围有限的 PAT读取并执行构建和测试。不知道为什么我会收到此错误。还有其他方法可以获取每次尝试的测试结果吗?我可以使用相同的连接来调用 GetTestResultDetailsForBuildAsync,但不幸的是,它列出了所有尝试的结果,而我只需要最后一个。
I am using the .NET client library for Azure DevOps to get test results from a build attempt. The following throws an authentication error, Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You are not authorized to access https://dev.azure.com.
var testClient = connection.GetClient<TestManagementHttpClient>();
var testResults = await testClient.GetTestResultsByBuildAsync2(
project: project,
buildId: ID);
I am using a PAT that is scoped to read and execute Builds and Tests. Not sure why I'm getting this error. Is there another way to get test results per attempt? I am able to use this same connection to call GetTestResultDetailsForBuildAsync
but unfortunately, that lists results for all the attempts and I just need the last one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请尝试以下任一方法来解决
Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: 您无权访问 https://dev.azure.com.
错误:参考:VS30063:您无权访问 https://dev.azure.com?尝试使用 PAT 令牌在 Azure DevOps 项目中注册专用代理池时出错 - Microsoft 问答、c# - VS30063:您无权访问 https://dev.azure.com - 堆栈内存溢出 和Visual Studio 反馈
Try either of the following ways to resolve
Microsoft.VisualStudio.Services.Common.VssUnauthorizedException: VS30063: You are not authorized to access https://dev.azure.com.
error:References: VS30063: You are not authorized to access https://dev.azure.com? Error while trying to register Private agent Pool in Azure DevOps Project using PAT token - Microsoft Q&A , c# - VS30063: You are not authorized to access https://dev.azure.com - Stack Overflow and Visual Studio Feedback
我遇到了同样的问题,但所有建议都没有帮助。我还可以调用其他一些方法,但不能调用
GetTestResultsByBuildAsync
。幸运的是,我注意到有不同类型的客户端:
如果我使用
testClient1
,那么调用下面的代码工作正常,但当我使用testClient2
时,会因身份验证错误而失败。:请尝试使用
TestResultsHttpClient
而不是TestManagementHttpClient
。I had the same issue and none of the suggestions helped. I was also able to call some other methods but not the
GetTestResultsByBuildAsync
.Luckily, I have noticed that there are different types of clients:
Then calling the code below worked fine if I used
testClient1
and failed with an authentication error when I usedtestClient2
.:Please try to use
TestResultsHttpClient
instead ofTestManagementHttpClient
.