3

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

1

1 Answer 1

1

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.

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

3 Comments

Both links are broken mate
Is that a down vote because links to a third party site from over a year ago are no longer valid? A simple google of the 2 classes documented gives the current documentation.
Maybe next time just propose an edit with the revised URLS? They are only links to the official microsoft documentation that has clearly changed structure.

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.