The "you do not have permission to view this directory or page" error is a generic error that appears in production. I would recommend reviewing this similar post in Stack Overflow that offers detailed troubleshooting for this particular error.
In order to see more detailed error messages you need to go to the Azure portal > App Services > Your app > App service logs > Detailed Error Messages > Turn on.
Then in your web.config, add
<customErrors mode="Off" /> before system.web closing tag,
</system.web>. Then add
<httpErrors errorMode="Detailed"></httpErrors> before
</system.webServer> and upload your web config to Azure. Then you should see the new error message with more detail as described here.
Other possibilities to check:
- Make sure your application is deployed to the correct root folder
- Ensure that AAD/Entra logins are enabled under Your App Service > Settings > Authentication/Authorization > Add identity provider (i.e. Microsoft) > Configured > Manage Azure Active Directory: Manage Permission > Add > Delegate permission > "Sign users in" and "View users' basic profile"
Last, make sure that you do not restrict IP in the IIS config in your web.config file. If the following is added, remove it if you do not want to restrict IP addresses:
<security> <ipSecurity allowUnlisted="false"> <clear /> <add ipAddress="192.168.250.70" allowed="true" /> </ipSecurity > </security>
I would also recommend reviewing the solutions to this issue in this detailed Stack Overflow post. Enabling the application logs should give you some insights though.
Let me know if this helps and if you still face this issue.
If the information helped you, please Accept the answer. This will help us as well as others in the community who may be researching similar information.