cancel
Showing results for 
Search instead for 
Did you mean: 

PowerShell - To Get PowerBI datasources from Report ID using Azure runbook

I am using Powersehll in Azure run book with Service principal account to connect PowerBI. However, I am unable to fetch the datasource with the help of Report ID.

 

I've tried the below API to get the datasources based on the reportid but powershell encountered an error.

GET https://api.powerbi.com/v1.0/myorg/reports/{reportId}/datasources

 

Source Code example.

/*

$wreContainer = Invoke-PowerBIRestMethod -Url $url -Method Get | ConvertFrom-Json
$wreContainer 
*/
 
I am getting below error when I ran this code. Not able to find what it is trying to say.

 

krish11_0-1623863232648.png

 

I really appreciate your help. Please please help me. Thank You in Advance...
Status: New
Comments
v-lili6-msft
Community Support

hi

Is your runbook running on Powershell Core 6 or better?

and have a look this document:

https://docs.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-6.1.0&viewFallbackFrom=azp...

 

 

Regards,

Lin