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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Error using REST API to deploy/import dataflow using Service Principal

I am trying to import/deploy a dataflow using the REST API.

 

https://api.powerbi.com/v1.0/myorg/groups/{groupid}/imports?datasetDisplayName=model.json&nameConfli...

Documentation: https://docs.microsoft.com/en-us/rest/api/power-bi/imports/postimportingroup

 

The error I get is this:

{
  "@odata.context":"http://wabi-west-us-redirect.analysis.windows.net/v1.0/myorg/groups/ecf0a3e1-ff60-44ab-a33f-585f1531...":{
    "code":"DataflowUnauthorizedError","details":[]
  },"name":"RRao1 - Test - CRM Account Option Sets","connectionType":"import","source":"Upload","datasets":[],"reports":[]
}
 
I have tested the same code to deploy PBIX and that works. So, the SPN does have access to PowerBi and the ability to publish some files. I am just not sure why I am getting the DataflowUnauthorizedError. Other commands against dataflows (get, etc) all work.
 
Here is the error I get when I run it using PowerShell: The remote server returned an error: (401) Unauthorized.
 
TIA
6 REPLIES 6
powerbi_jenhen
Resolver II
Resolver II

Did you ever get this to work as I'm in the exact same boat as you? Looks like the only artefact type a service principal cannot deploy is a dataflow for some mad reason. I receive the error: "ALM_InvalidRequest_ServicePrincipalNotSupported"

Anonymous
Not applicable

HI @Anonymous,

So you mean direct upload to import data flow works, but rest API failed? If this is a case, did other rest API works on your account? I'd like to suggest you check your azure account and related permission and setting to confirm if you have the permissions to use rest API.
Regards,
Xiaoxin Sheng

Anonymous
Not applicable

Using the exact same api and the spn, upload is successful with a pbix file.

Using the same api and my login, upload of dataflow is successful.

Using the spn and the same api, the upload fails with a dataflow.

 

I have checked to make sure dataflow read write all has been set on spn via azure portal.

Hey @Anonymous - were you able to figure this one out ? I get the exact same behaviour.

lbendlin
Super User
Super User

Did you follow these instructions?

 

Required scope: Dataset.ReadWrite.All
To set the permissions scope, see https://docs.microsoft.com/en-us/power-bi/developer/embedded/register-app.

Anonymous
Not applicable

Yes!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.