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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
soldous
Advocate II
Advocate II

How to authorize with Power BI Admin acc against Microsoft Identity Platform v2 programmatically

Hi all,

 

I need to acquire an access token for my PBI admin account entirely programmatically so without any user interaction. I used to use version 1 of Microsoft Identity Platform (https://login.microsoftonline.com/common/oauth2/token) and it worked fine for me.

 

I used to call the URL with this body:

grant_type=password

&username=mypowerbiadminacc@domain.com

&password=strongpassword

&client_id=clientid

&client_secret=cliencsecret

&resource=https://analysis.windows.net/powerbi/api

 

and receive the token to call the Power BI Admin API. But now I need to migrate to version 2 of the Microsoft Identity Platform (https://login.microsoftonline.com/common/oauth2/v2.0/token). In all documentation I've found there is the only option to acquire the token with client_credentials grant_type where I need to log in with my admin acc. Is there any way how to acquire the access token in version 2 without any user interaction?

Or is the MSAL library capable of this? I've not been familiar with this library yet so if I will need to or not.

 

I need this solution to regularly download all activity events from my Power BI tenant inside a .NET Core console app.

 

Let's not talk about the security of this solution. All my secrets will be stored in the Azure Key Vault. I just need to get the access token for my admin acc.

 

Thanks for any help.

 

2 REPLIES 2
michaelccdf
Helper I
Helper I

Did you ever figure this out?  I'm looking to do something similar.  Thanks.

Hello,

 

unfortunately not yet.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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