Forum Discussion

Jayasreeb's avatar
Jayasreeb
Frequent Visitor
5 years ago
Solved

PowerShell Script to Refresh PowerBI Dataset is failing

We use PowerShell script to refresh PowerBI Datasets. We run these scripts from SQL agent job.

The powershell script was running fine from our server for many days. But all of a sudden it started failing.I checked with Infrastructure team to see if any firewall settings are blocking the call to PowerBI. We couldn't find anything .

 

The same powershell script when ran from my desktop works fine and refreshes dashboard, but when it runs from server it gives me following error 

 

Invoke-RestMethod : The underlying connection was closed: An unexpected error occurred on a send.At 
+ ... $response = Invoke-RestMethod -Uri $uri –Headers $authHeader –Method ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

 

 

 

Any help to troubleshoot this issue is greatly appreciated.

5 Replies