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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Duftnich06
Regular Visitor

Power Query REST API Forgetting Settings

I've created a REST query that uses a bearer token, which it gets from a function I've created:
Function:

Duftnich06_1-1688547009228.png

Query:

Duftnich06_4-1688547366301.png


It refreshed fine for a while but then, after a certain amount of time, the refresh stops working and I get a 'can't authenticate using these credentials' message.
If I invoke my function it produces a new access token, so it can't be that. What I did was, go to my data source settings for the two queries, clear their permissions and then refresh again, ignoring privacy rules and they start refreshing again, without issue...
I can even clear permissions and set them to public and they refresh fine aswell!
With either solution, after a certain amount of time they stop working again and I have to repeat this exercise, clearing data source permisions and then refreshing them again, which is not helpful for the end client.

I created an Azure Datafactory pipeline, doing the same thing as Power BI and it worked for 3 days straight, refreshing every 15mins without issue, exporting to a JSON that I could import into Power BI. I also can replicate the REST API in Postman without any issues, leading me to believe the issue lies in Power BI somewhere.

Has anyone come accross this or have any dieas what is going on?
@ImkeF you've helped me before, any thoughts?

1 REPLY 1
Duftnich06
Regular Visitor

Update:
It appears to be the GetAccessToken() function that is causing the issue.
Essentially, if I stop it being a function, clear its permissions and then run it, setting the permissions on run time, it then returns a string happily. I then set it back to a function and then I can run everything else fine...weird!?
Any thoughts @ImkeF?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.