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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
celsius
Regular Visitor

Connect to API with custom sessionid

Hi, I'm total new in Power BI.

 

I have a problem which I can't figure out so maybe one of you can assist me.

 

We have a wepAPI for which we use to support our customers workflow. To give our customers extra insight we would like to use powerbi but I'm running into some issues.

 

Currently our customers log in to our web application to read/write data for their organisation. This web application is then communicating with a webAPI. When loggin in, the webAPI creates a sessionid which is being send within the header every time a request is made. This sessionid is than being used within our API to restrict data access to that specific user.

 

What I would like to do is the following:

1. create a login page (to obtain the sessionid from our webAPI)

2. use that sessionid for every Power BI report request made to our webAPI

 

I hope I made my problem clear.

 

Is this a possibility in Power BI?

Thanks!

 

Ps. I'm not looking for a RLS solution.

1 ACCEPTED SOLUTION
rohit1991
Super User
Super User

Hi @celsius ,
To connect Power BI to a web API that requires a session ID for authentication, you need to implement a custom method where Power BI first obtains the session ID upon login and then includes it in the header of every API request

Since Power BI does not provide a built-in interactive login page for custom authentication, this must be handled using Power Query (M language). The process involves sending login credentials to the API’s authentication endpoint, extracting the session ID from the response, and storing it for subsequent API calls. 

Every request to fetch data must then include this session ID in the request headers to ensure proper authentication. Additionally, if the session expires periodically, you must implement a way to re-authenticate and refresh the session ID before making new API calls. This method ensures secure access to customer-specific data while leveraging Power BI for reporting and insights. 

However, since Power BI does not natively support dynamic user authentication per session within a report, this approach is best suited for admin-managed datasets rather than end-user-driven authentication. If necessary, embedding Power BI within your web application using Power BI Embedded may provide a more user-friendly solution for seamless authentication.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

View solution in original post

2 REPLIES 2
rohit1991
Super User
Super User

Hi @celsius ,
To connect Power BI to a web API that requires a session ID for authentication, you need to implement a custom method where Power BI first obtains the session ID upon login and then includes it in the header of every API request

Since Power BI does not provide a built-in interactive login page for custom authentication, this must be handled using Power Query (M language). The process involves sending login credentials to the API’s authentication endpoint, extracting the session ID from the response, and storing it for subsequent API calls. 

Every request to fetch data must then include this session ID in the request headers to ensure proper authentication. Additionally, if the session expires periodically, you must implement a way to re-authenticate and refresh the session ID before making new API calls. This method ensures secure access to customer-specific data while leveraging Power BI for reporting and insights. 

However, since Power BI does not natively support dynamic user authentication per session within a report, this approach is best suited for admin-managed datasets rather than end-user-driven authentication. If necessary, embedding Power BI within your web application using Power BI Embedded may provide a more user-friendly solution for seamless authentication.


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!
lbendlin
Super User
Super User

That sessionid is meaningless to Power BI. You would need to implement all the security in your embedding framework. You are using Power BI Embedded, right?  

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors