Change the AuthorizationLevel to Anonymous.
public static async Task<IActionResult> Run(
[HttpTrigger(**AuthorizationLevel.Anonymous**, "get", "post", Route = null)] HttpRequest req,
ILogger log){
}
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have my azure functions app working fine in general. I enabled function level authorization and already providing x-functions-key with the correct key in the header.
So azure function is consumed by an Android app, in the appcenter logs, i am seeing some logs have
"StatusCode": 401,
"ReasonPhrase": "Unauthorized",
This makes no sense. I have fully logged request and request is just fine when i re-execute it using postman or similar. In the Azure portal under functions availability all green and in the connected Application Insights nothing is reported. Why am i getting this response?
EDIT:
Beside that error there are a few others in the Appcenter diagnostics. 503 and 404 response codes there are also. When i try to find those requests in the Azure portal I have no trace neither in Azure Functions monitoring nor in Application insights. What kind of issue is this?
Change the AuthorizationLevel to Anonymous.
public static async Task<IActionResult> Run(
[HttpTrigger(**AuthorizationLevel.Anonymous**, "get", "post", Route = null)] HttpRequest req,
ILogger log){
}
@Emil Alipiev 401 error shouldn't be observed until and unless the authentication is not passed correctly. As you have confirmed that you are passing the x-functions-key correctly and the same request works from the postman as per your observation. I would like to take a closer look offline at how you are calling the function app.
For 404 error there might be some calls where the request URL was not correct when called from a different application. 503 error we need to look into more details at the function app end as there could be different reasons for 503 (Service Unavailable) errors.