title: How do I add cors to a Blob Container using @azure/arm-storage nodejs
body: <p>So, I've been tinkering for a while now and I've been struggling with adding cors to my Blob Containers in Azure using the @azure/arm-storage nodejs package.</p>
  <p>Anyone got a clue how to set service properties?</p>
  <p>Here is what I got:</p>
  <pre class="lang-js prettyprint-override"><code>  async setCorsOnResource(storageAccountName, cors) {
      try {
        const service = await this.createBlobServicesManager();
  
        service.setServiceProperties(this.resourceName, storageAccountName, cors);
  
      } catch (err) {
        console.error(err);
      }
    }
  </code></pre>
  <p>cors look like this:</p>
  <pre class="lang-js prettyprint-override"><code>    const cors = {
        CorsRule: [{
          AllowedOrigins: ['*'],
          AllowedMethods: ['GET'],
          AllowedHeaders: [],
          ExposedHeaders: [],
          MaxAgeInSeconds: 60
        }],
      };
  </code></pre>
  <p>At this point I'm just mashing things together but I don't know what I'm doing wrong.</p>
  <p>Here is their documentation if you want to get a better understanding of how the BlobServices class works.
  <a href="https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-arm-storage/11.0.0/interfaces/blobserviceproperties.html#cors" rel="nofollow noreferrer">https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-arm-storage/11.0.0/interfaces/blobserviceproperties.html#cors</a></p>