I'm getting a HTTP 400 Bad Request when trying to append bytes to an append blob in Azure Storage. The Azure Storage Account already exists.
The Azure documentation only has an example call to the AppendText()
method, but this method includes a warning about using this method with multiple client writers. Hence, I would like to use the AppendBlock()
method instead, to ensure that calls are atomic.
var cred = new StorageCredentials("storageaccountname", "storageaccountkey");
var account = new CloudStorageAccount(cred, true);
var client = account.CreateCloudBlobClient();
var container = client.GetContainerReference("csharp");
container.CreateIfNotExists();
var log = container.GetAppendBlobReference("artofshell.log");
var stream = new MemoryStream(1024);
var text = System.Text.Encoding.ASCII.GetBytes("Log entry #1");
stream.Write(text, 0, text.Length);
log.CreateOrReplace();
log.AppendBlock(stream);
Any ideas what could be causing this?
- Windows 10 Enterprise Insider Build 14332
- Visual Studio 2015
- WindowsAzure.Storage library 7.0.1-preview