0

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.

Sunny-Dee
  • 87
  • 9

1 Answers1

0

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:

  1. Clean the cache as suggested by Marina Liu:Execute regedit -> clean key(s) under HKEY_CURRENT_USER\Software\Microsoft\VSCommon\14.0\ClientServices\TokenStorage\VisualStudio\VssApp -> restart VS -> run your project with your own credential.

  2. Check whether Personal Access Token has expired or created with the right Scope or not

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

Madhuraj Vadde
  • 1,099
  • 1
  • 5
  • 13