I am trying to create an Azure function that runs when I add an image to a container on my blob memory account.
The only thing that works is when I have a string parameter, but the files are images, so I cannot use a string containing image data.
So, I try every example that I can find on the Internet (not so many), and now I tried the samples from azure webjobs sdk - this is not wokring either. So either I'm stupid, what I feel right now, am I missing something obvious?
There are some errors that I get:
Microsoft.Azure.WebJobs.Host: Error Indexing Method 'Functions.thumbnailgenerator'. Microsoft.Azure.WebJobs.Host: Cannot bind BlobTrigger to type "Microsoft.WindowsAzure.Storage.Blob.ICloudBlob".
Microsoft.Azure.WebJobs.Host: Error Indexing Method 'Functions.thumbnailgenerator'. Microsoft.Azure.WebJobs.Host: BlobTrigger cannot be bound to the type "Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob".
Currently, the function I'm trying to execute is the one shown in the example above, and like many others I tried, it does not work with anything but strings.
So, how do I create a function (with C #) and a function.json file so that it works with blob and preferably a string called blob. Either this, or blob in and one out, where the name outblob is in another container, and the name has a prefix with a hard-coded string.
This is what I got now and it does not work:
function.json
{ "bindings": [ { "type": "blobTrigger", "name": "blob", "direction": "in", "path": "kitimages/{name}.{ext}" }, { "type": "blob", "name": "output", "direction": "inout", "path": "thumbnails/{name}_300_200.{ext}" } ], "disabled": false }
run.csx
#r "Microsoft.WindowsAzure.Storage" using System; using Microsoft.Azure.WebJobs.Host; using Microsoft.WindowsAzure.Storage.Blob; public static void Run(CloudBlockBlob blob, CloudBlockBlob output, TraceWriter log) { log.Info($"C# Blob trigger function processed a blob. Blob={blob.Name}"); }
EDIT . Check out the final solution to my question here: Doing work in the cloud