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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Robinator
Frequent Visitor

How to refresh Datasets with PowerBI REST API - executed in Azure Data Factory Pipeline

Hi,

 

I've built multiple pipelines in Azure data factory and a few Power BI reports (https://app.powerbi.com) that use data from those pipelines. My ultimate goal is to be able to refresh a Power BI data set at the end of a pipeline. Underneath I'll show a small selection of what i've read and tried so far. 

 

https://medium.com/@Konstantinos_Ioannou/refresh-powerbi-dataset-with-microsoft-flow-73836c727c33

https://mitra.computa.asia/articles/msdn-how-use-power-bi-embedded-rest

 

I started by registrating at https://dev.powerbi.com/apps and with API Acces "Select All". I checked in the azure portal the app registrations. I registrated twice because i was not sure if the oauth20 (following @konstantinos) would screw thing up: 

 

ADF App services App registrations.PNG

 

ADF App services App registrations (2).PNG

 

Then I started in Azure data factory, but after a while (of having failures) I started using Fiddler to send the HTTP Post request. 

 

I use the logic described at https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/refreshdatasetingroup. It says: 

 

"POST https://api.powerbi.com/v1.0/myorg/groups/{groupId}/datasets/{datasetKey}/refreshes"

 

I get my group and dataset ID at https://app.powerbi.com/.... 

 

Group and dataset id.PNG

 

->  https://api.powerbi.com/v1.0/myorg/groups/ecb52bc1-........................../datasets/ab5d2d28-.......

 

I copy this link into Fiddler: 

Fiddler Try.PNG

 

Fiddler Response headers.PNG

 

 

 

My best guess would be that i should include authentication into the request body, although i cant find examples online. 

 

 

Eventually I want to refresh the dataset  from a 'web' container in ADF. Although, lets start succesfully refreshing something first 🙂 

ADF - Refresh dataset from Web container.PNG

7 REPLIES 7
Robinator
Frequent Visitor

yaay, some small progress

 

Postman - get acces token.PNG

Used the following as Powershell script, and it worked Cat Happy 
 
 
$body = @{
"client_id" = "bf..........";
"grant_type" = "password";
"username" = ".......@........."; 
"password" = ".............";
"scope" = "openid"
}
$authResponse = Invoke-RestMethod -Uri $authUrl –Method POST -Body $body




$headers = @{
"Content-Type" = "application/json";
"Authorization" = $authResponse.token_type + " " +
$authResponse.access_token
}

 

$restResponse = Invoke-RestMethod -Uri $restURL –Method GET -Headers $headers

 

$datasetId = "ab5d......."
$groupId = "ecb5......"
$restUrl = "https://api.powerbi.com/v1.0/myorg/groups/$groupId/datasets/$datasetId/refreshes"

 

$body = @{
"notifyOption"= "MailOnFailure"
}

 

$restResponse = Invoke-RestMethod -Uri $restUrl –Method POST -Headers $headers -Body $body

Thanks for the help Robinator!

 

You're welcome 

another step forward, not sure how i get this token into a new API post

 

Postman - get acces token new version.PNG

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.