Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
But they return the same data. I was wondering if there's a way to make them have data from the different tenants.
Jason
Solved! Go to Solution.
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.
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
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.