3

I need to created single azure function listening for multiple blob container. Is it possible?

1 Answer 1

3

No, each Azure Function has exactly one trigger. However, there is an alternative. You can implement the processing of the blob in a generic method, define several Functions and have them all call the generic method.

Something like (pseudo code):

[FunctionName("BlobTriggerContainer1")]
public static async Task Run([BlobTrigger("container1/{name}")]Stream fileBlob, string name)
{
    await DoTheMagicAsync(fileBlob, name);
}

[FunctionName("BlobTriggerContainer2")]
public static async Task Run([BlobTrigger("container2/{name}")]Stream fileBlob, string name)
{
    await DoTheMagicAsync(fileBlob, name);
}

private void DoTheMagicAsync(Stream stream, string name)
{
    // Do your (async) magic here
}

An alternative solution would be to use Azure Event Grid. For more info on how to combine these services, see Tutorial: Automate resizing uploaded images using Event Grid.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.