Forum Discussion

SBrown_Murphy's avatar
SBrown_Murphy
Frequent Visitor
2 years ago
Solved

Looking for the Power BI API for MQuery

When administering a Power BI enviorment were the reports source their data from on-prem SQL databases I've found it is hard match a problem SQL query I see in the database with the symantic model th...
  • lbendlin's avatar
    lbendlin
    2 years ago

    How do you plan to authenticate?  Did you register an app in AD with the required scope?

     

    $requestBody = @"
    { "queries": [{ "query": "EVALUATE TOPN(10,Dates,[Date])"}]
     ,"serializerSettings":{"includeNulls":true}
    }
    "@
    Login-PowerBI
    $requestUrl = "datasets/xxx/executeQueries"
    $result = Invoke-PowerBIRestMethod -Method Post -Url $requestUrl -Body $requestBody
    $parsed = $result | ConvertFrom-Json

     

     

    Here is a script with manual authentication.