title: How to set overwrite in Azure BlobClient when using BlobUploadOptions
body: <p>I noticed in the debug trace my current approach is triggering a HEAD on the blob - presumably to check if it already exists. I know it never will, and if it did exist I want to overwrite. I just want a straight PUT to shave a few milliseconds and importantly reduce noise in Application Insights Application map where HTTP 404 errors show up as failures on Azure Blob dependency.</p>
  <p>There is no option within <a href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.models.blobhttpheaders.cachecontrol?view=azure-dotnet" rel="nofollow noreferrer">BlobHttpHeaders</a>, neither can I find any such overwrite option in <a href="https://docs.microsoft.com/en-us/dotnet/api/azure.storage.blobs.models.blobuploadoptions.transferoptions?view=azure-dotnet" rel="nofollow noreferrer">BlobUploadOptions</a>. What am I missing ?</p>
  <p>I want to do all the work of setting Content-Type and Tags in a single call. I am aware of the below override, but that would entail subsequent requests to set Content-Type and Tags which I want to avoid.</p>
  <pre class="lang-cs prettyprint-override"><code>UploadAsync(Stream content, bool overwrite = false, CancellationToken cancellationToken = default)
  </code></pre>
  <p>SDK Assembly Azure.Storage.Blobs, Version=12.10.0.0</p>
  <p><strong>My current code:</strong></p>
  <pre class="lang-cs prettyprint-override"><code>                // blob settings
                  var options = new BlobUploadOptions()
                  {
                      // set content type
                      HttpHeaders = new BlobHttpHeaders()
                      {
                          ContentType = contentType,
                          ContentEncoding = &quot;UTF-8&quot;
                      },
                      // Set blob index tags
                      Tags = new Dictionary&lt;string, string&gt;
                      {
                          { &quot;quoteid&quot;, &quot;123&quot; },
                          { &quot;responseId&quot;,&quot;456&quot; }
                      }
                  };
  
                  // upload blob
                  var content = Encoding.UTF8.GetBytes(data);
                  using var ms = new MemoryStream(content);
                  await blobClient.UploadAsync(
                      ms,
                      options
                      );
  </code></pre>
  <p><strong>Update:</strong></p>
  <ol>
  <li>The HEAD is being triggered by BlobBaseClient.Exists</li>
  <li>Also asked on <a href="https://github.com/Azure/azure-sdk-for-net/issues/25972" rel="nofollow noreferrer">GitHub</a> by someone else</li>
  </ol>