I put on a Sharepoint site an ajax request to my azure function.

This azure function requires authentication because its logic depends on which user is using my sharepoint site. All users who test my sharepoint site have authenticated this azure function by calling it in a separated browser tab.

The problem is that when this azure function is called inside the Sharepoint site - a request to login.windows.net appears. I can see this in my browser network tools.

Why this is happening? A user who was logged into the Sharepoint had already authenticated this azure function. Moreover, he could call this azure function in a separated browser tab.

Does it mean that Sharepoint calls azure functions not on behalf of the currently logged user but as a some kind of special user?

If yes - how can I authenticate this special user to my azure function?

Thank you, Mike

1 Answer 1


The reason why the ajax request with Azure Function was redirected to login window was the lack of the following lines in the ajax request:

xhrFields: { withCredentials: true },

I have found a great help here: https://briantjackett.com/2018/05/01/calling-azure-ad-secured-azure-function-externally-from-javascript/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.