Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define Path for Azure Blob Storage trigger in Azure Function

Is there a way to trigger Azure Function without defined concrete container?

I'm expecting, that function below will be triggered for any file in any container. Name of file and container should be in variables.

*****function.json:
{
 "bindings": [
   {
    "type": "blobTrigger",
    "name": "myBlob",
    "path": "{container}/{name}",
    "connection": "AzureWebJobsStorage",
    "direction": "in"
   }
],
 "disabled": false
}

*****run.csx:
public static void Run(Stream myBlob, string name, string container, TraceWriter log, out string outputSbMsg)
{
    log.Info("C# Blob trigger function Processed blob");
    log.Info(name);
    log.Info(container);      
}

However, nothing is triggered. Any idea what is wrong?

like image 559
Chatumbabub Avatar asked Mar 07 '17 01:03

Chatumbabub


People also ask

Where can you define the trigger bindings for an Azure function?

Trigger and binding definitions json, the portal provides a UI for adding bindings in the Integration tab. You can also edit the file directly in the portal in the Code + test tab of your function. Visual Studio Code lets you easily add a binding to a function. json file by following a convenient set of prompts.

How does Azure function blob trigger work?

The function is triggered by the creation of a blob in the test-samples-trigger container. It reads a text file from the test-samples-input container and creates a new text file in an output container based on the name of the triggered file.


1 Answers

Is there a way to trigger Azure Function without defined concrete container?

I assume that there is no way to trigger Azure Function without defined concrete container currently. From the Azure Function document, we could use the Azure storage blob trigger to moniter a storage container.

The Azure Storage blob trigger lets you monitor a storage container for new and updated blobs and run your function code when changes are detected

Base on my experience, we need to create multiple Azure functions to monitor the blobs as a work-around.

Update:

As mathewec mentioned it is an opened issue, more details please refer to it.

like image 175
Tom Sun - MSFT Avatar answered Sep 22 '22 15:09

Tom Sun - MSFT