Azure Storage Blobs

Container Reference

Container Reference

This document provides a reference for Azure Storage blob containers, detailing their properties, operations, and associated resources.

Container Properties

A container in Azure Blob Storage is a named object that holds a set of blobs. Containers are analogous to directories in a file system.

Container Operations

You can perform various operations on containers using REST APIs, Azure SDKs, or Azure CLI/PowerShell.

1. Create Container

Creates a new container within a storage account.

Request Example (REST API):

PUT /<storage-account-name>/<container-name>?restype=container HTTP/1.1
Host: <storage-account-name>.blob.core.windows.net
x-ms-version: 2020-08-04
x-ms-date: Tue, 27 Jul 2021 02:27:33 GMT
Authorization: SharedKey <storage-account-name>:<signature>
Content-Length: 0

2. List Containers

Lists all containers within a storage account.

Request Example (REST API):

GET /<storage-account-name>?comp=list&restype=container HTTP/1.1
Host: <storage-account-name>.blob.core.windows.net
x-ms-version: 2020-08-04
x-ms-date: Tue, 27 Jul 2021 02:27:33 GMT
Authorization: SharedKey <storage-account-name>:<signature>

Response Snippet:

<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults ServiceEndpoint="https://<storage-account-name>.blob.core.windows.net/">
  <Containers>
    <Container>
      <Name>container1</Name>
      <Properties>
        <Last-Modified>Tue, 27 Jul 2021 02:00:00 GMT</Last-Modified>
        <Etag>"0x8D95A77A52F4752"</Etag>
        <LeaseStatus>unlocked</LeaseStatus>
        <PublicAccess>container</PublicAccess>
      </Properties>
    </Container>
    <Container>
      <Name>container2</Name>
      <Properties>
        <Last-Modified>Mon, 26 Jul 2021 23:00:00 GMT</Last-Modified>
        <Etag>"0x8D95A67A52F4751"</Etag>
        <LeaseStatus>locked</LeaseStatus>
        <PublicAccess>none</PublicAccess>
      </Properties>
    </Container>
  </Containers>
  <NextMarker />
</EnumerationResults>

3. Get Container Properties

Retrieves system properties, user-defined metadata, and tags for the specified container.

Request Example (REST API):

HEAD /<storage-account-name>/<container-name>?restype=container HTTP/1.1
Host: <storage-account-name>.blob.core.windows.net
x-ms-version: 2020-08-04
x-ms-date: Tue, 27 Jul 2021 02:27:33 GMT
Authorization: SharedKey <storage-account-name>:<signature>

4. Set Container Properties

Sets system properties, user-defined metadata, or tags for the specified container.

Request Example (REST API - Setting Public Access):

PUT /<storage-account-name>/<container-name>?restype=container&comp=publicAccess HTTP/1.1
Host: <storage-account-name>.blob.core.windows.net
x-ms-version: 2020-08-04
x-ms-date: Tue, 27 Jul 2021 02:27:33 GMT
Authorization: SharedKey <storage-account-name>:<signature>
Content-Length: 39

<PublicAccess xmlns="">container</PublicAccess>

5. Delete Container

Deletes the specified container and all blobs contained within it.

Request Example (REST API):

DELETE /<storage-account-name>/<container-name>?restype=container HTTP/1.1
Host: <storage-account-name>.blob.core.windows.net
x-ms-version: 2020-08-04
x-ms-date: Tue, 27 Jul 2021 02:27:33 GMT
Authorization: SharedKey <storage-account-name>:<signature>
Note: Container names are globally unique within your Azure subscription. Ensure that you choose descriptive and unique names.

Container ACLs and Shared Access Signatures (SAS)

You can control access to containers and blobs through Access Control Lists (ACLs) and Shared Access Signatures (SAS). ACLs define permissions for anonymous users, while SAS provides delegated access for specific users with defined permissions and expiry times.

Container Security

It is crucial to implement robust security measures for your containers. Consider the following: