Search code examples
azure-web-app-serviceazure-functionsazure-container-service

EXECUTION_CONTEXT_FUNCTIONDIRECTORY env variable not available for F# Azure Functions


https://github.com/Azure/azure-webjobs-sdk-script/wiki/Retrieving-information-about-the-currently-running-function describes a EXECUTION_CONTEXT_FUNCTIONDIRECTORY environment variable. But it's not available for F# functions. Also Microsoft.Azure.WebJobs.ExecutionContext doesn't provide a FunctionDirectory property.


Solution

  • This sample function confirms that the property does exist:

    let Run(req: HttpRequestMessage, log: TraceWriter, context: ExecutionContext) =
        log.Info context.FunctionDirectory
        req.CreateResponse(HttpStatusCode.OK, "Hello")
    

    (tested in the portal on v1 runtime)