File rename, Empty folder and container level ACL

vikas 1 Reputation point
2025-02-14T03:55:26.32+00:00

We are using Blob storage API for file storage in our application. We are facing the following challenges:

  1. Unable to rename the folders
  2. Unable to apply container level ACL
  3. Unable to create blank folder (folder without files)
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,192 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Nandamuri Pranay Teja 3,610 Reputation points Microsoft External Staff Moderator
    2025-02-14T04:51:18.4333333+00:00

    Hello Vikas,

    I understand that you are encountering difficulties in renaming the folders, applying container-level ACLs, and creating a blank folder (a folder without any files).

    • Please be informed that Azure Blob storage does not have a native "rename" operation for folders. To rename a folder, you would typically need to copy the contents of the folder to a new folder with the desired name and then delete the original folder. You can achieve this by listing the blobs in the source folder, copying each blob to the destination folder with the new name, and then deleting the original blobs.

    workaround: Create a new prefix for example, if your current folder is myfolder/, create a new prefix like new_myfolder/. Copy all blobs with the prefix myfolder/ to the new prefix new_myfolder/. Delete all blobs with the original prefix (myfolder/).

    • Azure Blob storage supports setting access control at the container level using Shared Access Signatures (SAS) or Azure RBAC (Role-Based Access Control) for management operations. To apply container-level ACL, you can generate a SAS token with the desired permissions and scope it to the container level. This allows you to control access to the entire container.

    Workaround: You can generate SAS tokens with specific permissions (read, write, delete) for individual blobs or containers. This provides granular control over access. Utilize Azure Role-Based Access Control to control access to the container and its blobs. You can assign roles like "Storage Blob Data Contributor" to specific users or groups.

    • Azure Blob storage does not have a concept of folders in the same way as a file system. Folders are virtual and are represented by the delimiter ("/") in blob names. To create a "blank folder" (a folder without files), you can upload a blob with a trailing "/" in the name. This acts as a placeholder for the folder. However, Azure Blob storage does not distinguish between folders and files, so the blob itself will exist.

    Workaround: If you need to represent an empty "folder," you can create an empty file (e.g., marker.txt) within that prefix. If you require a true hierarchical file system with folders, consider using Azure Files.

    References:

    1. Known issues with Azure Data Lake Storage- https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-known-issues#blob-storage-apis
    2. Access control lists (ACLs) in Azure Data Lake Storage - https://learn.microsoft.com/en-us/azure/storage/blobs/data-lake-storage-access-control#common-scenarios-related-to-acl-permissions

    Hope the above answer helps! Please let us know do you have any further queries.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members. 

    0 comments No comments

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.