3
votes

I am putting together a website which I would like to host static content via Azure Blob. The documentation is very clear on how to set "Public read access for blobs only" to a container via this document: https://docs.microsoft.com/en-us/azure/storage/storage-manage-access-to-resources

In my development environment I am using the Azure storage emulator (https://docs.microsoft.com/en-us/azure/storage/storage-use-emulator).

My question is: How can I set the permission of a container in the emulator to "Public read access for blobs only"?

1

1 Answers

4
votes

I think I answered my own question. Unlike the Azure Portal the Emulator does not provide a mechanism to create a container and by extension set/modify the access policy. Using a third party tool such as CloudBerry Explorer will allow for the setting of the policy when a container is created. Additionally it is possible to set/modify the policy through code:

https://docs.microsoft.com/en-us/azure/storage/storage-manage-access-to-resources

public static void SetPublicContainerPermissions(CloudBlobContainer container)
{
    BlobContainerPermissions permissions = container.GetPermissions();
    permissions.PublicAccess = BlobContainerPublicAccessType.Container;
    container.SetPermissions(permissions);
}