Azure function app secured by AAD: You do not have permission to view this directory or page

arunabha bhattacharya 181 Reputation points
2020-09-12T08:06:09.13+00:00

My goal: secure my azure function by azure active directory.
Steps:

  1. Created azure function app aes2020 under app service plan. Added function named 'key'.
  2. Registered app under Active directory as 'AES' with redirect url=https://aes2020.azurewebsites.net/.auth/login/aad/callback.
  3. Under function app, authentication / authorization, set 'Action to take..' to 'Login with Azure Active Directory'; under Express mode selected the registered function app as 'AES'.
  4. Enabled CORS = *.

Problem: when I enter my function url https://aes2020.azurewebsites.net/api/key in Browser I am asked to login to Azure active directory but then get error 'You do not have permission to view this directory or page.'. The browser url shows the callback url https://aes2020.azurewebsites.net/.auth/login/aad/callback. I am able to access the function if I set anonymous access.

What more I need to do?
24177-1.png24099-2.png24251-3.png24158-4.png24138-5.png
Thanks in advance.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,300 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,561 questions
{count} vote

Accepted answer
  1. arunabha bhattacharya 181 Reputation points
    2020-09-14T13:00:38.32+00:00

    I fixed the problem by checking ID tokens box in Azure Active Directory, App registrations, my function app, Authentication, Implicit grant. Found problem by seeing Azure AD log.

    24477-fix.pngThanks anyway.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful