0

I need to add files to an Azure Storage Account using an Azure Function App with a Queuetrigger. But the container needs to be added dynamically. How is that possible?

        public static async Task Run(
            [QueueTrigger("activitylogevents", Connection = "StorageConnectionAppSetting")] Log activitylogevents,
Dynamic ==> [Blob("{dynamicc container}/dev/bronze/logs.json", FileAccess.Read)] Stream streamIn,
            ILogger log)
        { ... Code doing stuff ... }

Thanks

2
  • Dynamic based on what? What determines the container name? Commented Aug 9, 2022 at 11:49
  • Is it possible to access the properties on the activitylogevents object comming in from the Queuetrigger ? Commented Aug 9, 2022 at 11:51

1 Answer 1

1

You can make use of IBinder to dynamically define your BlobAttribute:

public static void MyFunction1(
[QueueTrigger("activitylogevents", Connection = "StorageConnectionAppSetting")] Log activitylogevents,
IBinder binderIn,
ILogger log)
{
    var blobInAttribute = new BlobAttribute(myUrl, FileAccess.Read) { Connection = "StorageConnectionAppSetting" };
    var streamIn = binderIn.Bind<Stream>(blobInAttribute);
    //other code
}
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.