https://community.powerbi.com/t5/Report-Server/Refresh-power-bi-report-from-SSIS/td-p/1793665
https://stackoverflow.com/questions/57791650/how-to-refresh-a-powerbi-report
We are working with Power BI Server (on-prem). For this particular report, we are importing data into the pbix file.
Our ETL is done with SSIS. What we want is the Power Bi Report to be refreshed only when ETL completes successfully.
In other words, we would like SSIS to trigger the Power BI report refresh. Has anybody done it?
Thanks for any help with this.
# Retrieve the scheduled refresh data for a specific report and set it to a variable to get the Id value
$refreshplan = Invoke-RestMethod -UseDefaultCredentials <# -Credential $creds #> -uri "[ReportServerURL]/reports/api/v2.0/PowerBIReports(path='[REPORTPATH]')/CacheRefreshPlans"
# This is how you can reference the Id value in the results from above
$refreshplan.value.Id
$refreshplan.value.LastRunTime
$refreshplan.value.LastStatus
# Using the above Id value, create the URI string to run the Model.Execute method
try {
$refreshuri = "[ReportServerURL]/reports/api/v2.0/CacheRefreshPlans(" + $refreshplan.value.Id + ")/Model.Execute"
}
catch {$error[0]}
# Invoke the Model.Execute method to start the scheduled refresh for the PBIX report
Invoke-RestMethod -UseDefaultCredentials <# -Credential $creds #> -method POST -uri $refreshuri -verbose
# To check on the scheduled refresh status, you can update the data in $refreshplan by running the CacheRefreshPlans again
$refreshplan = Invoke-RestMethod -UseDefaultCredentials <# -Credential $creds #> -uri "[ReportServerURL]/api/v2.0/PowerBIReports(path='[REPORTPATH]')/CacheRefreshPlans"
# Get the LastRuntime and LastStatus values to check the status
$refreshplan.value.LastRunTime
$refreshplan.value.LastStatus