Custom authentication for Azure functions app

Parag Kale 25 Reputation points
2025-04-25T11:29:50.6033333+00:00

I have a use case where there is anonymous auth set on functions which we are invoking from a nuget package and they get added to our main functions app. We have no control to change that code.

I want to authenticate those functions

we don’t have Authentication set for the main functions app in the azure portal. Hence don’t want to include it , as that could break our application functions

is there a example of implementing custom auth for the functions coming from the nuget

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

Accepted answer
  1. Kyle Burns 91 Reputation points Microsoft Employee
    2025-04-25T14:35:02.0033333+00:00

    The least disruptive way for you to accomplish this would be to run the Durable Functions Monitor functionality in a separate Function App with EasyAuth enabled. You may also choose to run it containerized on your local computer. Both methods are described in https://github.com/scale-tone/DurableFunctionsMonitor/blob/master/durablefunctionsmonitor.dotnetbackend/README.md.

    It is also possible to enable EasyAuth in an Azure Function App but only for specific paths. This can be achieved by using the globalValidation.excludedPaths setting or the WEBSITE_WARMUP_PATH environment variable to exclude specific paths from EasyAuth. You can exclude certain URL paths from EasyAuth using the globalValidation.excludedPaths setting. This allows you to enable EasyAuth for the entire Function App but exclude specific paths from requiring authentication. The WEBSITE_WARMUP_PATH environment variable can also be used to exclude specified paths from EasyAuth. This is particularly useful for scenarios where you need to allow unauthenticated access to certain endpoints, such as health probes.

    Using globalValidation.excludedPaths

    {
      "auth": {
        "enabled": true,
        "globalValidation": {
          "excludedPaths": [
            "/public/*",
            "/health"
          ]
        }
      }
    }
    
    

    Using WEBSITE_WARMUP_PATH

    Set the WEBSITE_WARMUP_PATH environment variable in your Function App settings:

    WEBSITE_WARMUP_PATH = /public/*,/health
    

    These methods are really intended to provided ways to have specific endpoints excluded from otherwise secured function apps, but with some creative handling of the paths may be leveraged to meet your goal.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.