December 2019
Intermediate to advanced
494 pages
11h 41m
English
We can do the same in Visual Studio. The following examples are the same as what we did in the portal, but in C# code.
To use a return output, add a return attribute. The following example triggers on a Service Bus queue and outputs a blob file:
[FunctionName("WriteFile")][return: Blob("outcontainer/{sys.randguid}.txt", FileAccess.Write, Connection = "StorageAccount")]public static string WriteFile([ServiceBusTrigger("myqueue", Connection = "ServiceBus")]string myQueueItem, ILogger log){ log.LogInformation($"C# ServiceBus queue trigger Function processed message: {myQueueItem}"); return myQueueItem;}
We can also use the output blob as an output parameter. Notice the out keyword:
[FunctionName("WriteFile")] ...