Azure Functions .NET Isolated Worker: Build and Configure a Reliable HTTP API

The .NET isolated worker runs the function application in a separate worker process from the Functions host. This model gives the application its own startup and dependency-injection configuration and is the recommended direction for modern .NET Functions projects.

When this pattern is useful

Build an Azure Functions HTTP endpoint with the .NET isolated worker, dependency injection, configuration and structured responses.

Implementation steps

  • Create a Functions project using the isolated worker template that matches your target .NET version and installed Azure Functions Core Tools.
  • Register services and configuration in Program.cs using the host builder. Keep secrets out of source control and use managed identity for Azure resources where possible.
  • Define an HTTP-triggered function with explicit route, authorization level and response status codes.
  • Run locally with local.settings.json for non-secret development settings, then publish and configure production application settings in Azure.

Example implementation

// Program.cs (.NET isolated worker)
var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
    .ConfigureServices(services =>
    {
        services.AddHttpClient<ICatalogClient, CatalogClient>();
        services.AddSingleton<IClock, SystemClock>();
    })
    .Build();
host.Run();

// HTTP-triggered function
[Function("Health")]
public HttpResponseData Run(
    [HttpTrigger(AuthorizationLevel.Function, "get", Route = "health")] HttpRequestData req)
{
    var response = req.CreateResponse(HttpStatusCode.OK);
    response.WriteString("healthy");
    return response;
}

Common pitfalls

  • Do not mix in-process and isolated-worker package references or startup patterns.
  • Do not hard-code connection strings or secrets in Program.cs.
  • Choose the HTTP authorization level deliberately; function keys are not a replacement for a full identity strategy.

Validation checklist

Run the function locally, verify the route and status code, then validate app settings and authentication after deployment.

Conclusion

A reliable implementation starts with a clear contract, explicit failure handling and repeatable environment configuration. Test the operational edge cases—not only the happy path—before making this part of a production workload.