sql-bi / Pbi-PushDataset

Validate and translate regular Tabular models in Push Datasets, also providing helper functions to clear, populate, and simulate real-time transactions.
MIT License
49 stars 15 forks source link

Operation returned an invalid status code 'Unauthorized' #7

Closed RaulRuizCorredor closed 2 years ago

RaulRuizCorredor commented 2 years ago

Hi,

I am stack, I run the script and I am gettig the following error message:

PUBLISH model Publish-PushDataset: One or more errors occurred. (Operation returned an invalid status code 'Unauthorized')

Mention that I followed all the steps and configured the app inside azure and grant privileges in Azure and Power BI Service. What I am doing wrong?

marcosqlbi commented 2 years ago

It seems a permission issue. Are you publishing on a workspace? It would be useful to understand whether you have an error in authentication (see Azure configuration) or during the publishing (it could be a Power BI issue).

Ypf485 commented 2 years ago

the same issue seems to be taking place for me too could you kindly list what are the key permissions we need to take care in Azure active directory, enterprise application and power bi admin portal to use the Publish feature

marcosqlbi commented 2 years ago

@Ypf485 did you already solve the problem (I've seen your post in another thread).

ghost commented 2 years ago

I'm facing the same problem. I have registered an application and granted it member permissions in my workspace. Does the app need any additional permissions?

marcosqlbi commented 2 years ago

@wnzn try to publish to a specific workspace, not to "my workspace"

ghost commented 2 years ago

Thanks for your response! I'm publishing to a specific workspace (of which I'm an owner, hence 'my'). Do I need to grant any permissions on the app registration in Azure AD?

marcosqlbi commented 2 years ago

The user account (or the service principal) that you use for publishing must have at least member access to the workspace.

ghost commented 2 years ago

Okay, well that's the case as well here. My guess now is that API access might be limited to a specific security group. I have tested this on a separate tenant and apparently you can add service principals to a workspace even if this setting is enabled but you can't use that service principal to access it. I'll post back when I have more information.

ghost commented 2 years ago

Just came to add that my guess was correct: after adding the service principal to the correct group, it works perfectly. Thanks @marcosqlbi for your ideas.

marcosqlbi commented 2 years ago

Great - thanks for closing the loop!