Use F # in Azure Functions

What is the best way to use F # in Azure Functions at the moment? I want my function to have both input and output bindings (for example, to queues or event hubs)

What I have found so far:

Is there a way to take the F # function with inputs and outputs and place it as an Azure function directly? Something similar to the C # Run method?

Ideally, inputs and outputs should be strongly typed: object, record or discriminatory union.

+6
source share
2 answers

Templates are intended only for the starting point - you can easily add additional I / O bindings to them on the Integration tab of the portal. For example, if you add new Blob output called result and bind to the blob path "test-output/%rand-guid%" , you can write a script as shown below, which blob writes:

 open System open System.IO let inputPath = Environment.GetEnvironmentVariable("input") let input = File.ReadAllText(inputPath) let message = sprintf "F# script processed queue message '%s'" input System.Console.Out.WriteLine(message) let resultPath = Environment.GetEnvironmentVariable("result") File.WriteAllText(resultPath, input); 

As for the more strictly typed support of the β€œfirst class” for F #, as I mentioned in the message on the forum with which you contacted, we are working on it :) At the moment, F # is in the bucket with all the others from the proc script, where The communication mechanism in and out of the binding pipeline passes through environment variables , as you can see above.

+6
source

Now F # is native!

Thanks to the excellent work of the F # team, including Don Sim and Tomas Petricek, we are pleased to announce that we finally support F # in a first-class style in Azure Functions.

https://blogs.msdn.microsoft.com/appserviceteam/2016/09/01/azure-functions-0-5-release-august-portal-update/

+5
source

All Articles