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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
jasonyeung87
Helper V
Helper V

Accessing data from 2 different tenants in graph API yields the same data.

Hi,

 

I'm trying to create a Power BI report that displays what Microsoft 365 licenses I have for my company's tenants. (we have 4 separate tenants). I'm following the link below:

2 Create Parameters with Power Query - networkgirlie - Obsidian Publish

 

It uses Graph API and this works perfectly and I was able to setup to query one of the tenants. It displays the license information and what users are assigned to them. However when I add a second tenant, it would query the same data as the first tenant. (I can tell by the domains of the users were of the first tenant). 

 

What I did is I setup the app registration in both and in Power BI, I created 2 sets of variables (for tenant, client and clientSecret) for each tenant. The power automate code in the red box uses the varialbes in the yellow box, while the code in the purple box uses the variables in the orange box:

jasonyeung87_0-1748302758132.png

But they return the same data. I was wondering if there's a way to make them have data from the different tenants. 

 

Jason

 

 

 

 

1 ACCEPTED SOLUTION
v-saisrao-msft
Community Support
Community Support

Hi @jasonyeung87, 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

The issue you're facing with both queries returning data from the same tenant is usually due to token reuse or shared query logic within Power BI. Even though you've defined separate credentials for each tenant, Power BI might be reusing the same access token or cached query steps, causing both queries to execute within the context of a single tenant. 

Instead of using shared queries or functions and swapping parameters, create completely separate queries for each tenant. Each query should independently handle its authentication and data retrieval process without referencing any common steps. This ensures the correct access token is used and each query operates strictly within its intended tenant’s context.

 

If this post helps, please give us ‘Kudos’ and consider accepting it as a solution to help other members find it more quickly.

 

Thank you. 

View solution in original post

3 REPLIES 3
v-saisrao-msft
Community Support
Community Support

Hi @jasonyeung87,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

Hi @v-saisrao-msft ,

 

Thanks for your help on this. I had tried to separate the authentication and tokens, but as the queries are almost identical, it was always grabbing the same information. 

 

To make it easier, I ended up creating a few Power Automate flows  (one for each tenant) which calls the Graph API's and save the results in a SharePoint list (e.g. this would act like a pseudo database of license / user information). The Power BI report will then query the SharePoint list to display the data. 

 

Jason

 

v-saisrao-msft
Community Support
Community Support

Hi @jasonyeung87, 

Thank you for reaching out to the Microsoft Fabric Forum Community.

 

The issue you're facing with both queries returning data from the same tenant is usually due to token reuse or shared query logic within Power BI. Even though you've defined separate credentials for each tenant, Power BI might be reusing the same access token or cached query steps, causing both queries to execute within the context of a single tenant. 

Instead of using shared queries or functions and swapping parameters, create completely separate queries for each tenant. Each query should independently handle its authentication and data retrieval process without referencing any common steps. This ensures the correct access token is used and each query operates strictly within its intended tenant’s context.

 

If this post helps, please give us ‘Kudos’ and consider accepting it as a solution to help other members find it more quickly.

 

Thank you. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors