I am trying to set up an azure function that would write into a blob only if a function is fulfilled. The blob is int he same location as the function, so I am trying to avoid providing a connection string and do this with bindings. I am currently using binding something like the following:
[Blob("folder/myFile.json", FileAccess.Write)]Stream writeBlob
With this binding, I can write into the JSON file using:
if (myCondition)
using (var writer = new StreamWriter(writeBlob))
writer.Write(myContent);
This works fine when the condition is true. However, when the condition is false, the file gets empty. Since I am not writing to the stream, I expected the file to stay untouched. Right now my workaround is to have another read binding to the same json and rewrite the file contents.