So I came onto this piece of code that was trying to replicate a BlockBlob from one place to another.
destinationBlob.Properties.ContentType = sourceBlob.Properties.ContentType;
First, it will download the whole block locally to re-upload it.
That is pretty awesome but what if your file is 500Mb? Yeah. It’s completely loaded into memory and your process memory usage will explode. Worse, if your process is 32bits, you might actually run into
OutOfMemoryException sooner rather than later.
Azure already provides a way to copy data from one blob to another. All this code was replaced by this single line of code.
If you don’t know how to do something in Azure, looking at the API or asking around might just save you a few hours of troubleshooting.