The Azure Storage SDK doens't provide an overload to have both parameters for overwrting and a BlobUploadOptions. But that is a common scenario.
By reading the implementations, it looks like it is easy to do:
using (Stream contentStream = File.OpenRead(@"C:\tmp\Test.txt"))
{
BlobUploadOptions overwriteWithTags = new BlobUploadOptions
{
// Set tags, properties and so on & so force. This has nothing to do with overwrite.
Tags = new Dictionary<string, string>
{
["TagB"] = "b",
},
// By default, there will be condition to prevent overwrite.
// Set the conditions to null so that overwrite will be allowed.
Conditions = null,
};
await blobClient.UploadAsync(contentStream, overwriteWithTags);
}It is twisted to find that not allowing overwrite is actually a SDK default, not a server one.
By default, the condition is:
// There is always going to be a match to fail this condition when the target blob exist.
new BlobRequestConditions
{
IfNoneMatch = new ETag("*")
}