powerbiazure-functionseasy-auth

Missing authorization_uri in WWW-Authorize header in Azure Function EasyAuth


I have configured my Azure Function with the out of the box Azure AD identity provider. When an unauthenticated request is made, it is returning the WWW-Authenticate header showing the realm, but missing the authorization_uri. This makes it impossible to use the function using Organization Credentials in Power BI, which requires authorization_uri to be present.

"New" EasyAuth/built-in auth 401 response

I believe this is an issue related to the "new" built-in EasyAuth, since the "classic" EasyAuth returned much more information, including resource_id. I have an older function to demonstrate:

"Classic" EasyAuth/built-in auth 401 response

The only workaround I have tried is to use Microsoft.Identity.Web in my Azure function code, but this is very hacky and adds a lot of complexity to otherwise simple code. EasyAuth keeps everything very simple and would work perfectly if it included more info in the WWW-Authenticate header.

How can I get a new Azure Function with EasyAuth enabled to return the authorization_uri in the WWW-Authenticate header in a 401 response?


Solution

  • Check your Authentication settings -> Unauthenticated requests, if it's not "HTTP 302", then Azure will not return authorization_uri and other data.

    enter image description here