Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't programmatically set permissions to blob container in Azure Storage
    primarykey
    data
    text
    <p>After creating a blob container with <code>CreateIfNotExists()</code>, I immediately call <code>SetPermissions()</code> to allow users public access to the blobs in the container, but not to the container itself.</p> <p>Like so:</p> <pre class="lang-cs prettyprint-override"><code>CloudBlobContainer pdfContainer = blobClient.GetContainerReference(ContainerName.PDFs); if (pdfContainer.CreateIfNotExists()) pdfContainer.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob }); </code></pre> <p>The container is created successfully, but when I log in to the Azure portal, the blob container permission is <code>Private</code>.</p> <p>Am I missing an additional call to commit the permission changes? None of the examples that I've looked at seem to show that and I don't see anything in the documentation either. I'm using v2.0 of the Azure SDK.</p> <p><strong>UPDATE:</strong></p> <p>It looks like <code>CreateIfNotExists()</code> is always returning false. I pried the assembly open in Reflector and found that it was catching a (409) Conflict HTTP error and swallowing the exception. This appears to be an issue with either the SDK or the server-side REST implementation. Even though the container does not exist and the container creation succeeds, a 409 is still returned from the server.</p> <p>It seems like the best thing to do is call <code>CreateIfNotExists()</code> and ignore the return value for now.</p> <p>Also, it is not necessary to call <code>GetPermissions()</code> before calling <code>SetPermissions()</code>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload