DEV Community

kemurayama
kemurayama

Posted on

When you want to create a new blob in your code Azure Functions

You can create a new blob file by writing like below.
Plus {rand-guid} generate guid. It is useful !!

Storage Account Setting is set by Storage Account Attribute.

[FunctionName("MyTestFuncion")]
[StorageAccount("StorageConnectionAppSetting")]

public static async Task Run([EventHubTrigger("myeh", Connection = "EHConnection")] EventData[] events,
        Binder binder,
        ILogger log)
    ...

    using (var writer = await binder.BindAsync<TextWriter>(
                        new BlobAttribute("<container>/{rand-guid}.json")))
                    {
                        writer.Write(<what you want to write>);
                    }
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay