In this example I am using Azure Functions to fetch and read files from Azure Blob Storage using Azure Functions.
A blob trigger activates when a blob is uploaded to an container. Here i use Stream
as the trigger attribute. When reading a file the trigger is used as a input binding, but when uploading a file it used as the output binding. The connectionstring cane easily be found in the local-settings.json file, which is created with the Blob trigger function.
[Blob("{BLOB-FILEPATH}",FileAccess.Write,Connection = "{CONNECTIONSTRING}")]
When creating a file, I've used an HTTP trigger as it's input binding. When uploading text to a new file, you can use Textwriter
as the trigger attribute. Otherwise using Stream
is the most logical to use.
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)]