maikvandergaag / msft-extensions

Repository for extensions mainly used for Azure DevOps Extensions
https://msftplayground.com
MIT License
126 stars 80 forks source link

Power BI Actions: "error":"unauthorized_client","error_description":"AADSTS700016: Application with identifier '***' was not found in the directory #534

Closed KristofKuli closed 3 months ago

KristofKuli commented 3 months ago

Describe the issue We are using self-hosted, Azure-based agents, which are behind company proxy. The Power BI Actions task is failing, the respective log can be found below, the company name and IDs are censored.

Extension

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior Release pipeline should finish successfully.

Situation (please complete the following information):

Log info 2024-03-05T15:42:50.1477017Z ##[debug]Connect-PowerBIServiceAccount : One or more errors occurred. 2024-03-05T15:42:50.1497387Z ##[debug]At C:\a\_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.48\run.ps1:54 char:5 2024-03-05T15:42:50.1516272Z ##[debug]+ ... Connect-PowerBIServiceAccount -Environment $organizationT ... 2024-03-05T15:42:50.1535647Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2024-03-05T15:42:50.1556332Z ##[debug] + CategoryInfo : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-Po werBIServiceAccount], AggregateException 2024-03-05T15:42:50.1576164Z ##[debug] + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAcc ount 2024-03-05T15:42:50.1593503Z ##[debug]

2024-03-05T15:42:50.2716815Z ##[debug] StatusCode: 400 2024-03-05T15:42:50.2736759Z ##[debug] ResponseBody: {"error":"unauthorized_client","error_description":"AADSTS700016: Application with identifier '***' was not found in the directory '<company name>'. This can happen if the application has not been installed by the administrator of the tenant or consented to by any user in the tenant. You may have sent your authentication request to the wrong tenant. Trace ID: <ID> Correlation ID:<ID>a Timestamp: 2024-03-05 15:42:49Z","error_codes":[700016],"timestamp":"2024-03-05 15:42:49Z","trace_id":"<ID>","correlation_id":"<ID>","error_uri":"https://login.microsoftonline.com/error?code=700016"} 2024-03-05T15:42:50.2754680Z ##[debug] Headers: Pragma: no-cache

Additional information Add any other context about the problem here.

maikvandergaag commented 3 months ago

Seems that something is going wrong with the service connection you have configured. Please check the configuration.

KristofKuli commented 3 months ago

Hi Maik,

Thank you for your answer. We have two types of self-hosted agent pools, one of them is using an on-prem proxy, while the other on is using an Azure-based one. When the pipeline is using the on-prem proxy, then the task works as expected and if it using the other one, then it is failing. Do you think the proxy can be the culprit?

maikvandergaag commented 3 months ago

Yes, I do I think you have to configure a default proxy for Azure DevOps as the task does not have a proxt configuration

KristofKuli commented 3 months ago

So you mean the task doesn't recognize the proxy set on the agents, as environment variables?

KristofKuli commented 3 months ago

Hi @maikvandergaag,

Issue was with the Service Connection, it used a wrong SPN. Thank you for your help, I am closing this ticket.