Skip to content

Instantly share code, notes, and snippets.

@AliYmn
Created December 3, 2019 19:41
Show Gist options
  • Save AliYmn/75479db7d334813ff8ea76ede8b1ba86 to your computer and use it in GitHub Desktop.
Save AliYmn/75479db7d334813ff8ea76ede8b1ba86 to your computer and use it in GitHub Desktop.
how i set new permission for containers?
from azure.storage.blob import BlockBlobService
from azure.storage import AccessPolicy
accountName = "*"
accountKey = "*"
def containersToUnPublic():
block_blob_service = BlockBlobService(account_name=accountName,
account_key=accountKey)
containers = block_blob_service.list_containers()
for c in containers:
access_policy = AccessPolicy(permission=ContainerPermissions.READ)
identifiers = {'id': access_policy}
block_blob_service.set_container_acl(c.name, identifiers)
block_blob_service.set_container_acl(c.name)
print("--> ", c.name, ' permession added...')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment