How to test Azure Functions Authentication locally
Asked Answered
S

1

6

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.

Solingen answered 30/12, 2018 at 21:59 Comment(5)
check your login url and redirect url. probably it is a configuration issueCordiform
Have checked those, all good. Sorry forgot to mention that I also have implemented a custom authentication method, that one also is working on Azure but not locally.Solingen
check this post but not sure if it will help, do you really need to test it locally ? it will work properly from the portal anyway... are you checking specific claims ? https://mcmap.net/q/504689/-is-it-possible-to-debug-azure-functions-locally-with-azure-active-directory-authentication/4167200Lifesaver
We need a bit more information, like some (relevant) code. Please try to provide a minimal reproducible example.Germangermana
Thanks, the issue has nothing to do with code, it's just a functionality that needs to be supported and enabled for Functions locally. I have now accepted the answer below.Solingen
S
4

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!

Strait answered 31/12, 2018 at 7:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.