Forum Discussion
Power BI REST API - Auto refresh access token
Hi timalbers
You may try the custom connector suggested by lbendlin .
For the access token question, an access token is generated according to the client and resource of the request. Since the current access token is for the same scope "https://analysis.windows.net/powerbi/api/.default", it won't be regenerated unless it gets expired. It's possible to extend the lifetime of an access token, but this requires some specific Microsoft Entra ID licenses. To learn more about the lifetime, please refer to Access tokens in the Microsoft identity platform - Microsoft identity platform | Microsoft Learn
Another alternative is to separate the current dataflow into different dataflows. For example, the first dataflow is to call the /reports endpoint to return all report IDs. The second dataflow references the first dataflow to get all report IDs, then call every single report ID to get report users. You can set different schedule refresh times for these dataflows, e.g. the first dataflow refreshes first, the second dataflow refreshes one or two hours later. This ensures that the second dataflow starts to refresh after the first dataflow's refresh completes and it will get a new access token then. Currently the dataflow also has refresh timeout threshold, so splitting a large dataflow can avoid refresh timeout in the future.
Understand and optimize dataflows refresh - Power BI | Microsoft Learn
Hope this would be helpful.
Best Regards,
Jing
If this post helps, please Accept it as Solution to help other members find it. Appreciate your Kudos!