I created a simple function with default code to say Hello <name>. I am able to run the code if the Authentication Settings under (Function -> Authentication) is set to "Allow unauthenticated Access".
As soon as I change those to "Require authentication" and add a Identity provider by following the documentation (https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad). the simple code start throwing Error. I am using Postman and able to generate the token but when I pass that tokens to access the function, it says 401 did I miss any configuration. I am gone through a lot of community article but none of them is clear. I still think that I am missing some authorization permission for the App Registration account which is not mentioned in the above article because as being a Global admin, I am able to access the function directly using browser and my credentials.
Token generator
Pass Token to call the function.
Error "You do not have permission to view this directory or page."