Search code examples
powershellapipowerbipowershell-2.0powershell-3.0

Error with retrieveing records from Power Bi API Datasets - Get Refresh History


I'm trying get Refresh Logs for each dataset from Power BI rest API with Power Shell script.

Documentation for API https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/getrefreshhistory

But I'm getting below error in power shell. could you please help me ? enter image description here


Solution

  • At first sight, you should use Invoke-PowerBIRestMethod instead of the generic Invoke-RestMethod. The first one will take care of adding the authorization token in the request for you, which you must add manually when using the generic cmdlet (and you didn't).