Azure function site page error

Callum 0 Reputation points
2024-10-08T13:53:24.34+00:00

Hi All,

I have created an Azure Function App for enhancing mail flow with MTA-STS (https://learn.microsoft.com/en-us/purview/enhancing-mail-flow-with-mta-sts). The site was created and is working fine; however, I am unsure how to set up an access denied error for the main site.

not sure how to define error message.

https://mta-test-pg.azurewebsites.net/

working as expected

https://mta-test-pg.azurewebsites.net/.well-known/mta-sts.txt

this is Microsoft site https://mta-sts.microsoft.com/

https://mta-sts.microsoft.com/.well-known/mta-sts.txt

anyone knows how to setup please advise.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,931 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pinaki Ghatak 5,600 Reputation points Microsoft Employee Volunteer Moderator
    2024-10-09T08:41:12.98+00:00

    Hello @Callum

    To set up a custom error message for your Azure Function App, you can use the Azure Portal to configure custom error pages. Here are the steps to follow:

    1. Navigate to your Azure Function App in the Azure Portal.
    2. Click on "Functions" in the left-hand menu.
    3. Click on "Configuration" in the top menu.
    4. Scroll down to the "Custom error pages" section and click "Add".
    5. In the "Status code" field, enter the HTTP status code you want to customize (e.g. 403 for access denied).
    6. In the "Path" field, enter the path to the custom error page you want to display (e.g. /errors/accessdenied.html).
    7. Click "OK" to save the custom error page configuration. Once you have set up the custom error page, any requests to your Azure Function App that result in the specified HTTP status code will display the custom error page instead of the default error message. In your case, you can create a custom error page for the 403 status code and specify the path to the error page you want to display. You can then test this by accessing a resource that you do not have permission to access, such as the main site, and verifying that the custom error page is displayed.

    I hope that this response has addressed your query and helped you overcome your challenges. If so, please mark this response as Answered. This will not only acknowledge our efforts, but also assist other community members who may be looking for similar solutions.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.