Azure storage Adls blob container set read only

Pankaj Joshi 331 Reputation points
2024-09-04T14:58:15.73+00:00

I have storage account with hierarchical namespace enabled. Now I have container "test" where I have uploaded one file, I need this file to be read only so that no one can update it. Now problem is "test" container inherit rbac role "storage data contributor" from parent which cannot be removed. How can I make file or container read only? Is it possible by ACL or any other option? Please advise

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,464 questions
Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,105 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,787 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 10,036 Reputation points
    2024-09-04T15:49:25.54+00:00

    Hello Pankaj Joshi,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you have a challenge with your container which inherit RBAC role "storage data contributor" from parent and cannot be removed.

    Regarding your questions:

    How can I make file or container read only? Is it possible by ACL or any other option?

    Yes, it is possible with ACL. You can the container read-only despite the inherited "Storage Blob Data Contributor" role, by using Access Control Lists (ACLs) to override the inherited permissions. Also, as an option, you can use Azure rbac as well as ACL. https://video2.skills-academy.com/en-us/azure/storage/blobs/assign-azure-role-data-access and https://video2.skills-academy.com/en-us/azure/storage/blobs/storage-auth-abac

    You can follow the below guides to achieve read-only implementation using Azure CLI or this YouTube link https://youtu.be/hjaP7u5d0x8 for more details on configurations and Azure Storage Explorer.

    # Set ACLs on the File
    az storage fs access set --acl "user::r--,group::r--,other::r--" --path <file-path> --account-name <storage-account-name> --file-system <container-name>
    # Set ACLs on the Container
    az storage fs access set --acl "user::r-x,group::r-x,other::r-x" --path <container-name> --account-name <storage-account-name> --file-system <container-name>
    # Use Azure Attribute-Based Access Control (ABAC)
    az role assignment create --role "Storage Blob Data Reader" --assignee <user-principal-name> --scope /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<storage-account>/blobServices/default/containers/<container-name>
    

    NOTE: Run the code one after the other and provide appropriate information for everything in a angle bracket < -- >.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.

    ** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.

    Best Regards,

    Sina Salam


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.