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

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

Reply
mlc-bi
Regular Visitor

Scheduled refresh OData source - invalid credentials with anonymous verification method

Hi there,

I have an issue with the scheduled refresh function in Power BI. I have published a PBIX file to the web environment of Power BI. As with other PBIX files, I set the scheduled refresh via the on-premises gateway. My PBIX file has data from several sources (MySQL, OData, other Web connectors). 

Setting up and connecting the MySQL source to scheduled refresh (via the gateway) works fine. However, when trying to connect the OData source to the gateway, this fails. The message shows that credentials are invalid, "AccessUnauthorized". However, via PBI Desktop there is no need for me to use credentials (as access is via Anonymous, with an API key "Bearer ........."). 

The following settings are used: 

 

Type of source:  OData

URL: https://tcodata.azurewebsites.net/estimates

Authentication method: Anonymous

Privacy-settings: None

 

The following code is used in PBI Desktop:

 

 

let
    apiUrl = "https://tcodata.azurewebsites.net/estimates",
    Source = OData.Feed(apiUrl , null, [Implementation="2.0", Headers =[#"Authorization"=Text.From(ApiKey)]])
in
    Source

 

No real authentication is needed, because it is accessed as Anonymous. However, when setting the scheduled refresh, this does not work (as credentials are said to be invalid).

 

Help is much appreciated, thanks!

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

Hi @mlc-bi 

When refreshing odata source in Power BI service, with the power query code as yours, you don't need to add it under the on-premise gateway, just go to "data setting"->"schedule refresh"->edit credential for that odata source, select "anonymous".

Similar threads:

https://community.powerbi.com/t5/Service/Refreshing-a-Restful-Data-Source-with-API-Key/td-p/131298

https://community.powerbi.com/t5/Power-Query/Dataset-Refresh-REST-API-amp-JSON-with-required-Param-i...

In addition, if all above don't work, maybe you can try to change the Privacy-settings from "None" to "Public".

 

As for mutiple data sources(on-premises and cloud) to refresh in Power BI Service, please check the documents, make the proper setting for your scenario.

https://docs.microsoft.com/en-us/power-bi/service-gateway-mashup-on-premises-cloud

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-juanli-msft
Community Support
Community Support

Hi @mlc-bi 

When refreshing odata source in Power BI service, with the power query code as yours, you don't need to add it under the on-premise gateway, just go to "data setting"->"schedule refresh"->edit credential for that odata source, select "anonymous".

Similar threads:

https://community.powerbi.com/t5/Service/Refreshing-a-Restful-Data-Source-with-API-Key/td-p/131298

https://community.powerbi.com/t5/Power-Query/Dataset-Refresh-REST-API-amp-JSON-with-required-Param-i...

In addition, if all above don't work, maybe you can try to change the Privacy-settings from "None" to "Public".

 

As for mutiple data sources(on-premises and cloud) to refresh in Power BI Service, please check the documents, make the proper setting for your scenario.

https://docs.microsoft.com/en-us/power-bi/service-gateway-mashup-on-premises-cloud

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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 Kudoed Authors