An Azure service that provides an event-driven serverless compute platform.
Hi @zmsoft,
Welcome to the Microsoft Q&A Platform! Thank you for reaching out regarding the basic Authentication for Azure Functions.
- In your function, the
AuthorizationLevel.Userallows anonymous access, which is why requests without theAuthorizationheader can still pass through. To ensure that only requests with valid credentials are allowed, change theAuthorizationLeveltoFunction[Function("Function1")] public async Task<IActionResult> NewOrder([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequest req)- Ensure that your function app is processing authentication middleware correctly.For that, you should call
app.UseAuthentication()in theConfigureAppConfigurationmethod.Uncomment and adjust the following:
.ConfigureAppConfiguration(app => { app.UseAuthentication(); }) - Ensure that your function app is processing authentication middleware correctly.For that, you should call
- Double-check that the
Authorizationheader is being parsed correctly and handle any errors gracefully.
If this answers your query, do click accept answer and yes for was this answer helpful. And, if you have any further query do let us know.