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