Created
December 3, 2019 19:41
-
-
Save AliYmn/75479db7d334813ff8ea76ede8b1ba86 to your computer and use it in GitHub Desktop.
how i set new permission for containers?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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