maikvandergaag / msft-extensions

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

Issue on Update Parameter and SQL Credential update #513

Closed sivabalan-ammaiyappan closed 4 months ago

sivabalan-ammaiyappan commented 7 months ago

Describe the issue We are observing some errors in the Update Parameter task and SQL Credential update in Azure DevOps pipeline

Extension

To Reproduce Steps to reproduce the behavior:

  1. We are using Update Parameter task and SQL Credential update in Azure DevOps pipeline

Expected behavior The Power BI parameter and SQL Credential has to be updated into the mentioned Power BI workspace. But we are observing the following error for Update Parameter Task and SQL Credential Update Task.

Situation (please complete the following information):

Log info

SQL Credential Update -Error Log:

[debug]Caught exception from task script.

[debug]Error record:

[debug]Invoke-PowerBIRestMethod : One or more errors occurred.

[debug]At D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1:1060 char:13

[debug]+ Invoke-PowerBIRestMethod -Url $ApiUrl -Method Patch -Body ...

[debug]+ ~~~~~~~~~~~~~

[debug] + CategoryInfo : WriteError: (Microsoft.Power...werBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIR estMethod], AggregateException

[debug] + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod

[debug]

[debug]Script stack trace:

[debug]at Update-BasicSQLDataSourceCredentials, D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1: line 1060

[debug]at , D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\run.ps1: line 189

[debug]at , : line 1

[debug]at , : line 22

[debug]at , : line 18

[debug]at , : line 1

[debug]Exception:

[debug]System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).

[debug] at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()

[debug] at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.d__35.MoveNext()

[debug] --- End of inner exception stack trace ---

[debug] at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)

[debug] at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.ExecuteCmdlet()

[debug] at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord()

[debug]---> (Inner Exception #0) System.Net.Http.HttpRequestException: Response status code does not indicate success: 401 (Unauthorized).

[debug] at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()

[debug] at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.d__35.MoveNext()<---

[debug]

[error]One or more errors occurred.

[debug]Processed: ##vso[task.logissue type=error]One or more errors occurred.

[debug]Processed: ##vso[task.complete result=Failed]

Update Parameter - Error log:

[debug]Caught exception from task script.

[debug]Error record:

[debug]Invoke-API : InvalidRequest

[debug]At D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1:238 char:9

[debug]+ Invoke-API -Url $url -Method "Post" -Body $body -ContentType ...

[debug]+ ~~~~~~~~~~~~~

[debug] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException

[debug] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-API

[debug]

[debug]Script stack trace:

[debug]at Invoke-API, D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1: line 307

[debug]at Update-PowerBIDatasetParameter, D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1: line 238

[debug]at Update-PowerBIDatasetParameters, D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\ps_modules\PowerBI\PowerBI.psm1: line 261

[debug]at , D:\a_tasks\PowerBIActions_d5b7fec6-2b25-4742-905b-0dad97687df5\5.4.44\run.ps1: line 208

[debug]at , : line 1

[debug]at , : line 22

[debug]at , : line 18

[debug]at , : line 1

[debug]Exception:

[debug]Microsoft.PowerShell.Commands.WriteErrorException: InvalidRequest

[error]InvalidRequest

[debug]Processed: ##vso[task.logissue type=error]InvalidRequest

[debug]Processed: ##vso[task.complete result=Failed]

Additional information Even though the pipeline got failed, The Parameters is getting updated in the PowerBI Workspace.

maikvandergaag commented 7 months ago

@sivabalan-ammaiyappan: Good to know that the parameters get updated. But it seems that you are still lacking some permissions as you also get a 401 (Unauthorized). How did you configure the permissions?

sivabalan-ammaiyappan commented 7 months ago

@maikvandergaag We are using Azure AD Service principal and Provided Admin rights to the Power BI Workspace. But still we are getting 401 (Unauthorized) Error. With same service principal, Publish Report to Power BI workspace task is successful.

For the other task (Update Parameter), Do I need to make any changes or update anything ?

sivabalan-ammaiyappan commented 7 months ago

@maikvandergaag Any idea on this issue?

zhunipingan commented 5 months ago

Hi @sivabalan-ammaiyappan , I meet the Unauthorized error when do uploading the report, I enabled the SP can access to PowerBI rest apis, but still have this error, do you have any suggestions, thanks.

maikvandergaag commented 5 months ago

@zhunipingan and @sivabalan-ammaiyappan what are the api permissions you have selected for the service principal you are using?

github-actions[bot] commented 4 months ago

It looks like there hasn't been a reply in 30 days, so I'm closing this issue.