Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

SPN to query PBI dataset using REST api calls

Hi,

I am trying to use "REST api support for DAX" feature relased by MSFT in aug for public preview.

https://powerbi.microsoft.com/en-us/blog/announcing-the-public-preview-of-power-bi-rest-api-support-...

 

I have been able to query dataset and retreive the result using my creds but the issue is i am not able to succeed with SPN.I have set up SPN the way it has been described in the MSFT document below to allow rest api calls with DAX but i am unable to understand what is blocking the SPN.

https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-porta...

 

I receive "401 unauthorized error " with SPN. 

 

My steps:

-created AAD app and SPN

-created AAD security group and added the SPN as member into it

-provided SPN and security group 'admin' access on the PBI workspace

-provided 'dataset.readwrite.all' permission for the app

-added the SPN to allow REST api calls on tenant settings

-workspace upgraded to v2

 

Am i mising something ? Also,is it required for me the provide the app with tenant.read.all permission? I dont see this as requirement in msft docs but i did see this in some other online discussions.

2 REPLIES 2
TomMartens
Super User
Super User

Hey @Anonymous ,

 

here on my github repo you will find some examples on how to create a SPN and use this in combination with the Power BI Admin Scanner REST APIs. There is a presentation and some PowerShell scripts that you might find useful.

 

Hopefully, this helps to tackle your challenge, if not please share your code, otherwise it's difficult provide more guidance: https://github.com/tomatminceddata/thehive

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany
Anonymous
Not applicable

thanks and I looked at the files and i have followed the simiar steps with respect to import modules - preparing auth with variables- connecting to PBI service acc..

 

I see no difference in my code,unfortunately,i am still having same '401 unauthorized' error

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.