I started encountering an issue using the following about two weeks ago. It had been working fine, but then I started seeing an exception without any code changes.
$pbiResponse = Request-PBIDatasetRefresh -authToken $authToken -dataset $datasetId -groupId $groupId
I believe the default of GET is applied to method so I was wondering if that became a problem for some reason or the default target url is having problems. Any ideas here?
Exception:
[Error] ERROR: Invoke-RestMethod : {"error":{"code":"PowerBIEntityNotFound","pbi.error":{"code":"PowerBIEntityNotFound","parameters":{},"details":[],"exceptionCulprit":1}}}At D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1:2375 char:19+ ... $result = Invoke-RestMethod -Uri $url -Headers $headers -Method $me ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (Method: GET, Reques\u2026PowerShell/6.2.6}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandScript stack trace:at Invoke-PBIRequest, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2375at Get-PBIDataSet, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 908at Request-PBIDatasetRefresh, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2015at , D:\home\site\wwwroot\RefreshData\run.ps1: line 39Microsoft.PowerShell.Commands.HttpResponseException: Response status code does not indicate success: 404 (Not Found).at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: ERROR: Invoke-RestMethod : {"error":{"code":"PowerBIEntityNotFound","pbi.error":{"code":"PowerBIEntityNotFound","parameters":{},"details":[],"exceptionCulprit":1}}}At D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1:2375 char:19+ ... $result = Invoke-RestMethod -Uri $url -Headers $headers -Method $me ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (Method: GET, Reques\u2026PowerShell/6.2.6}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandScript stack trace:at Invoke-PBIRequest, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2375at Get-PBIDataSet, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 908at Request-PBIDatasetRefresh, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2015at , D:\home\site\wwwroot\RefreshData\run.ps1: line 39Microsoft.PowerShell.Commands.HttpResponseException: Response status code does not indicate success: 404 (Not Found).at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)Exception: Response status code does not indicate success: 404 (Not Found).Stack: at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
2020-08-27T19:04:41.664 [Error] ERROR: Invoke-RestMethod : {"Message":"API is not accessible for application"}At D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1:2375 char:19+ ... $result = Invoke-RestMethod -Uri $url -Headers $headers -Method $me ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (Method: POST, Reque\u2026PowerShell/6.2.6}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandScript stack trace:at Invoke-PBIRequest, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2375at Request-PBIDatasetRefresh, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2018at , D:\home\site\wwwroot\RefreshData\run.ps1: line 39Microsoft.PowerShell.Commands.HttpResponseException: Response status code does not indicate success: 403 (Forbidden).at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: ERROR: Invoke-RestMethod : {"Message":"API is not accessible for application"}At D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1:2375 char:19+ ... $result = Invoke-RestMethod -Uri $url -Headers $headers -Method $me ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : InvalidOperation: (Method: POST, Reque\u2026PowerShell/6.2.6}:HttpRequestMessage) [Invoke-RestMethod], HttpResponseException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommandScript stack trace:at Invoke-PBIRequest, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2375at Request-PBIDatasetRefresh, D:\home\site\wwwroot\PSModules\powerbips.2.0.4.5\PowerBIPS.psm1: line 2018at