The error message "You do not have permission to view this directory or page" typically appears when the Azure Function App is expecting authentication, but no valid authentication token is provided.
In your case, it seems that the authentication (Easy Auth) is enabled, but the app is not redirecting users to sign in.
Please check the following:
Ensure that the App Registration has the correct Redirect URI set to: https://<yourfunction>.azurewebsites.net/.auth/login/aad/callback
In the Function App Authentication settings, configure Unauthenticated requests to "Redirect to login page" instead of blocking them.
After making these changes, try accessing your function again. You should be redirected to sign in and, upon successful authentication, be able to access your app without error.
If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.