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
swindhorst
Frequent Visitor

Web.Contents anonymous auth on root URL failing

I'm using Web.Contents to call an API using and API Key as a url parm.   When I published to the Power BI  Service the refresh was failing with error "Query contains unsupported function. Function name: Web.Contents".  After researching, I found numerous posts about this and how you must use the root URL with RelativePath to resolve.   When I changed that in Desktop, it trys to authenticate against the root url, and when selecting anonymous it fails.   The root URL for this API redirects to a sign-in page.  I tried using Basic Auth and valid creds and it failed also.   It seems that for some APIs the solution to use root URL and RelativePath with WebContents does not work.   

 

The problem doesn't seem to lie with WebContents but with Power BI Service not supporting refresh using a full path (with query parms) with WebContents.  Is that a correct statement?

3 REPLIES 3
blopez11
Super User
Super User

I have experienced the same, where I had to use the base url as the first parameter to webcontents, then a combination of relative path and the query options

 

There have been other articles written on how to get around the power bi service trying to authenticate against the base url for anonymous that I have used successfully, but I wasn't using an api key

 

How are you passing your api key?  Is their a specific header you are using or the canned one in webcontents?

Yeah, no header; it's passed in the query string.   Authentication occurs in Desktop too, not just Power BI Service.  The reason why I stated that it's a Power BI Service issue is that when using the full url with api key parameter in Web.Contents, no RelativePath etc. it works in Desktop.

My experience, when working with web service apis, is what works in the desktop, doesn't always work in the service

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors