Nagarajan.M
Nagarajan.M

Reputation: 93

store json on blob storage using Azure function c#

I want to store json on blob storage using azure function c#

For example my json is :

{
"a":"a",
"b":"b",
"c":[{"c1":"c1"},{"c2":"c2"}]
}

I would like to write to the file or even read from the file.

Are there any samples of writing and reading to files using Azure functions c#?

Thank You

Upvotes: 3

Views: 4157

Answers (1)

Tom John
Tom John

Reputation: 784

Have a look at the CloudStorageAccount class:

https://learn.microsoft.com/en-us/dotnet/api/microsoft.azure.storage.cloudstorageaccount?view=azure-dotnet

Using these you can create a CloudBlobClient and CloudBlobContainer. Then the CloudBlockBlob class:

https://docs.azure.cn/zh-cn/dotnet/api/microsoft.windowsazure.storage.blob.cloudblockblob?view=azure-dotnet

Use the CloudBlockBlob class:

CloudBlockBlob.UploadFromByteArray(...) to Upload, and cloudBlockBlob.DownloadToByteArray(...) to Download your file.

Upvotes: 1

Related Questions