Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Not applicable

Call Power BI API in Power Query

I'm trying to retrieve data from Power BI API services and the same is being accomplished via PowerShell code. But unfortunately due to some circumstances I am not able to deploy it in production. Hence now I am trying to get the same thing done in Power BI desktop itself so that I can call power BI rest API from Power Query only. There are tons of blogpost about calling an API in power query but they all require Power BI App registered Client ID. Which I don't have. I'm successfully able to call with my user name password in PowerShell and even I'm getting response from API.

Please find below PowerShell code and let me know if we can replicate the same in Power Query.

# User credential
$User = 'shahab***@*****.com'
$Pword = ConvertTo-SecureString –String '***password***' –AsPlainText -Force

$Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User,$Pword

# Connect to service
Login-PowerBIServiceAccount -Credential $Credential  

#Get Bearer token
$headers = Get-PowerBIAccessToken  

$uri = '' 
$refreshes = Invoke-RestMethod -Uri $uri -Headers $headers -Method GET
$xs= $refreshes

Helpful resources


Fabric certifications survey

Certification feedback opportunity for the community.


Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors