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
gtzanakis
Advocate I
Advocate I

API DataflowUnauthorizedError when trying to update a Dataflow although all permissions are set

Dear all,

 

I am using the following script trying to update the computeEngineBehavior of a Dataflow of mine.

 

 

#!/bin/bash

# Obtain access token
echo "Requesting access token..."
TOKEN_RESPONSE=$(curl -s -X POST \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials&client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&resource=https%3A%2F%2Fanalysis.windows.net%2Fpowerbi%2Fapi" \
  "https://login.microsoftonline.com/$TENANT_ID/oauth2/token")

# Extract access token from response
ACCESS_TOKEN=$(echo $TOKEN_RESPONSE | jq -r '.access_token')

if [ -z "$ACCESS_TOKEN" ] || [ "$ACCESS_TOKEN" == "null" ]; then
  echo "Failed to obtain access token. Please check your credentials."
  exit 1
fi

# Update the Dataflow
echo "Sending request..."
RESPONSE=$(curl -s -X PATCH \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"computeEngineBehavior": "computeDisabled"}' \
  "https://api.powerbi.com/v1.0/myorg/groups/$WORKSPACE_ID/dataflows/$DATAFLOW_ID")

echo "Response: $RESPONSE"

 

 

When I run it, I'm getting the following error:

 

{"error":{"code":"DataflowUnauthorizedError","message":"You do not have permissions to manage this dataflow."}}

 

 

However:

 

1. I have double-checked all environmental variables regarding the workspace & dataflow IDs, secrets, etc.

2. My Service Principal has Admin access to this workspace

3. My Service Principal has "Dataflow.ReadWrite.All" (and, in fact, almost every permission under the sun) in its API permissions section

4. If I modify my script to POST a refresh request, it works great

5. I can perform this type of request with my personal credentials when using the "Try it" button in the corresponding API documentation page.

 

Can anybody explain to me why I'm getting this error and how I can fix it?

 

gtzanakis_0-1721300126452.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @gtzanakis ,

Service principal only supports some read-only admin APIs. Since you mentioned that POST requests for refreshing dataflows work, you might need to use personal credentials or a different authentication method for update operations.

Embed Power BI content in an embedded analytics application with service principal and an applicatio...

vyiruanmsft_0-1721374399729.png

Supported APIs

 

Solved: PBI Service, Dataset refresh fail - DataflowUnauth... - Microsoft Fabric Community

Got an answer from the support.

For me the problem was that i can't refreshing a dataset in a pro workspace that are getting data from dataflows in a PPU workspace. That's too bad because then PPU is kind of useless for me for now.


Best Regards

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @gtzanakis ,

Service principal only supports some read-only admin APIs. Since you mentioned that POST requests for refreshing dataflows work, you might need to use personal credentials or a different authentication method for update operations.

Embed Power BI content in an embedded analytics application with service principal and an applicatio...

vyiruanmsft_0-1721374399729.png

Supported APIs

 

Solved: PBI Service, Dataset refresh fail - DataflowUnauth... - Microsoft Fabric Community

Got an answer from the support.

For me the problem was that i can't refreshing a dataset in a pro workspace that are getting data from dataflows in a PPU workspace. That's too bad because then PPU is kind of useless for me for now.


Best Regards

Hey @Anonymous ,

 

Thank you for your reply, this helps. After reading your posts, I realized I cannot use a Service Principal to update the configuration of a workflow. It says so in your screenshot as well: Dataflows management is not supported. 

 

Since I wanted to perform the API call non-interactively, I think I have no options. Thank you very much again!

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.

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

60 days of Data Days Carousel

Data Days 2026

Join 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.