Forum Discussion
Service account - PowerBINotAuthorizedException
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?
13 Replies
- v-echaithra
Community Support
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 LearnIf 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. - v-echaithra
Community Support
Hi mehuljain ,
We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra. - v-echaithra
Community Support
Hi mehuljain ,
As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra.- mehuljain
Microsoft Employee
Hi, Thanks for your suggestion.
As of now, it is not working with service accout.
We haven't tried it for service percipal as our environment will not allow http calls.
Thanks
- v-echaithra
Community Support
Hi mehuljain ,
Thanks for the update.Make sure the service account has an active Power BI Pro license.
Add Service Account to the Workspace, ensure the service account is a member or contributor.
Ensure the service account has "Build" permission on the dataset.
Sign in to Power BI Connector in Power Automate. In Power Automate: Open Data > Connections.
Find the Power BI connector and edit/re-authenticate it using the service account's credentials.
Manually test access in Power BI service by Loging into https://app.powerbi.com using the service account. Try opening the dataset or report manually. If access is denied here too, it's not a Power automate issue, it’s a permission problem in Power BI.
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.
Regards,
Chaithra.
- v-echaithra
Community Support
Hi mehuljain ,
May I ask if you have gotten this issue resolved?
If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.
Regards,
Chaithra. - v-echaithra
Community Support
Hi mehuljain ,
We wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?
If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.Regards,
Chaithra.