Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure website message "You do not have permission to view this directory or page.". What to do?

Tags:

reset

web

azure

After I published an ASP.NET Core app to Azure from Visual Studio 2017 I am getting this message when I click on the app url:

enter image description here

It was working fine before. Is there a way to figure out what's wrong with my pushed changes?

like image 675
Adam Avatar asked Feb 18 '18 15:02

Adam


People also ask

How do you fix You do not have permission to view this directory or page Azure?

Check Web App > Authentication /Authorization and Web App > Networking > Access Restrictions. Create the production build by executing 'npm run build' command. A build folder will be generated in the solution with some meta data files. Reference the build folder while deploying the react app to azure.

How do I grant application permissions in Azure?

Grant admin consent in App registrationsSelect Azure Active Directory, and then select App registrations. Select the application to which you want to grant tenant-wide admin consent. Select API permissions. Carefully review the permissions that the application requires.

How do I access my Azure storage on the web app?

In the Azure portal, go into your storage account to grant your web app access. Select Access control (IAM) in the left pane, and then select Role assignments. You'll see a list of who has access to the storage account.


3 Answers

You do not have permission to view this directory or page.

That's basically a hint when Azure encounters an error while running your web app. Since its in production, it does not show any useful error messages. For testing/debugging purposes you can turn on the Azure detailed messaging, and turn back off when its ready for production. To do so, you have to follow these two steps,

  • Login to Azure > App Services (left side menu) > Your Web App > App Service logs (search box is at the top if you can't find it), then turn on Detailed Error Messages or turn on all of the logging options, up to you.
  • Add the following in your Web Config file: Add <customErrors mode="Off" /> BEFORE system.web closing tag, </system.web>. Similarly, add <httpErrors errorMode="Detailed"></httpErrors> BEFORE </system.webServer>. Finally, upload the Web Config to Azure and cross your fingers.

If you follow the steps correctly, that will show the error messages in detail and hopefully from there you will figure out what went wrong. Good Luck!

like image 118
Hafiz Temuri Avatar answered Oct 17 '22 22:10

Hafiz Temuri


  • The fist thing you should do is actually go and check the folders if your war got unpacked inside the webapps folder. for that if your web url is "xyz.azurewebsites.net" then try to open xyz.scm.azurewebsites.net. This should redirect you to KUDU interface where you can see few tabs. From those tabs select Debug Console and then select CMD from the drop down. This should give you a folder structure.Now Go to site->wwwroot->webapps . There check if your war got unpacked.
  • If not then try restarting the web app and see id this does the trick. If while creating your app service plan you have selected the Standard pricing tier, change it to premium
  • Last but not the list you can enable logging for you app. Then go to Monitoring-> Diagnostics logs . Turn those setting on. Then select Log streaming(Just below Diagnostics logs).

Hope this help.

like image 11
user3351386 Avatar answered Oct 17 '22 22:10

user3351386


From my experience, if your login user ID under Azure Active Directory (AAD), you have to modify in Settings:

  • Authentication / Authorization
  • App Service Authentication, "ON" =>> choose: Log in With Azure Active Directory
  • Select 'ActivityProvider', base on your purpose. In my case, I'm using AAD.
  • Configured (Express: Existing APP)
  • Manage Azure Active Directory: Manage Permission & Manage Application

For Manage Permission ==>> Add, In Delegate Permission, choose: Sign in and read user profile and refresh your browser to login again

like image 7
Daleman Avatar answered Oct 17 '22 21:10

Daleman