Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Hi,
We have created a power Automated flow. In those flows are using power BI connectors to get the data from power BI reports. We have written a dax query and created a connection using workspace ID and Dataset ID it is working fine.
We are trying to create a connection using service account, but it is giving us the error - 'PowerBINotAuthorizedException'
How can we access it using Service account?
Hi @mehuljain ,
Thank you for reaching out to Microsoft Community.
Check whether Power BI Tenant Settings is Configured to enable Service Principals to use API's.
if the app that you create for your service principal authentication has any Power BI permissions assigned to it then the access token that is generated (when passed to Power BI REST Admin API) will return an error response that reports PowerBINotAuthorizedException.
To be even more specific, if the access token that you pass to the Power BI API has a roles key/value pair, then you will get a PowerBINotAuthorizedException.
In Power BI, service principals need to be explicitly allowed to use APIs. Check your Power BI tenant settings and verify that service principals are enabled for API access.
If you've enabled service principal access, make sure the service account is part of the security group that has API permissions.
If your Azure app has Power BI permissions assigned to it, this can sometimes cause authorization issues. Try removing unnecessary Power BI permissions from the app and test again.
Ensure that the access token generated for the service account is valid and correctly formatted when making API requests.
Assign Power BI Pro license to the service account
Add the service account to the Power BI workspace (Member or Contributor).
Grant Build permissions to the dataset
Sign into Power BI connector in Power Automate as the service account
Use the "Run a query against a dataset" action with proper Dataset ID & Workspace ID
Reference: Enable service principal authentication for admin APIs - Microsoft Fabric | Microsoft Learn
If this post helps, please give us Kudos and consider marking it Accept as solution to assist other members in finding it more easily.
Regards,
Chaithra.
@mehuljain the error your receiving refers to the account not having the necessary permissions to access the BI dataset. Please ensure that your service account is a workspace admin for the workspace that contains the dataset.
User | Count |
---|---|
47 | |
31 | |
28 | |
27 | |
26 |
User | Count |
---|---|
58 | |
55 | |
36 | |
33 | |
28 |