title: Why does Azure Blob Storage return 201, but not upload?
body: <p>After much pain and suffering I was finally able to get a 2xx status code from the Azure Blog Storage API on an upload request. I am not sure why this is so difficult when to compared to AWS S3.</p>
  <p>Here is the code that I am using to upload a voice recording:</p>
  <pre class="lang-js prettyprint-override"><code>var blockId = btoa(&quot;Test&quot;);
  $.ajax({
      url: `https://${app}.blob.core.windows.net/blob/test.mp3?comp=block&amp;blockid=${blockId}&amp;${sas}`,
      type: 'PUT',
      contentType: 'audio/mpeg',
      data: audio.audioBlob,
      processData: false,
      headers: {
          'x-ms-blob-type': 'BlockBlob',
          'x-ms-date': new Date().toGMTString(),
          'x-ms-version': '2020-02-10'
      }
  });
  </code></pre>
  <p><a href="https://i.stack.imgur.com/4ZpcU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4ZpcU.png" alt="NetworkTab1" /></a></p>
  <p><a href="https://i.stack.imgur.com/njCbo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/njCbo.png" alt="NetworkTab2" /></a></p>
  <p>I am not sure if it matters, but I am using the following Chrome command to bypass CORS from my local machine.</p>
  <pre><code>chrome.exe --user-data-dir=&quot;C:/Chrome dev session&quot; --disable-web-security
  </code></pre>
  <p>I did try to enable CORS in the Azure Portal by setting the following values, yet that did not work.</p>
  <ul>
  <li>AllowedOrigins: *</li>
  <li>AllowedMethods: GET,PUT</li>
  <li>AllowedHeaders: *</li>
  <li>ExposedHeaders: *</li>
  <li>MaxAgeInSeconds: 86400</li>
  </ul>
  <p>I was so excited I got a 2xx status code that I jumped to the Azure Portal. Unfortunately my file was not there. I thought it may be asynchronous so I waited 10 minutes. The recording I sent was only 5 seconds long so I'm certain it would not take longer than that.</p>
  <ul>
  <li>I checked the Monitoring graphs in Azure, which all showed 0 data.</li>
  <li>I double checked the information in my request and the Shared Access Signature, which looked correct to me.</li>
  </ul>
  <p>Do you know what's happening here?</p>