Search code examples
c#azureazure-functionsazure-functions-runtimeazure-authentication

How to test Azure Functions Authentication locally


Can someone please point me to the right direction with this; I have setup Azure Functions Authentications, it works fine when I deploy my function to Azure but locally the token is not validated hence the I can't retrieve the authenticated user. I am using Microsoft and Facebook authentications as well as a custom Authentication method, all working fine on Azure but locally none of them work!

I found this article which explains how it is done for Azure Mobile Apps however it seems that the method provided is not going to be possible for Functions.


Solution

  • Unfortunately, according to the How can we improve Microsoft Azure Functions? issue opened on Azure's feedback site, it seems that the functionality you require is currently not supported, but they are "looking into" it.

    To work with the function locally, you'll probably need to mock the principal in some way.

    Hope it helps!