Manage Azure Storage Containers

This tutorial guides you through the process of managing containers in Azure Blob Storage. Containers are essential for organizing data within your storage account.

What are Azure Storage Containers?

A container in Azure Blob Storage is a logical grouping of blobs. Think of it like a folder or directory in a file system. You must create a container before you can upload any blobs to it. Containers can hold an unlimited number of blobs.

Prerequisites

Create a Container using the Azure Portal

Step 1: Navigate to your Storage Account

Sign in to the Azure portal. In the portal, search for and select your storage account.

Step 2: Access Containers

In the storage account menu, under Data storage, select Containers.

Step 3: Create New Container

On the Containers page, select + Container.

In the Create container dialog:

  • Enter a unique name for your container (e.g., my-sample-container). Container names must start with a letter or number, and can contain only letters, numbers, and the hyphen character (-).
  • Select a public access level. For most scenarios, Private (no anonymous access) is recommended.
  • Click Create.

Create a Container using Azure CLI

You can also create containers using the Azure Command-Line Interface (CLI). Make sure you have the Azure CLI installed and are logged in to your account.

az storage container create \
    --name mycli-sample-container \
    --account-name mystorageaccountname \
    --auth-mode login \
    --public-access off
            

Replace mycli-sample-container with your desired container name and mystorageaccountname with your storage account name.

Managing Container Properties

Once a container is created, you can manage its properties:

Setting Public Access Level

You can change the public access level of a container after it's created. Be cautious when setting public access to Blob or Container, as it exposes data to the internet.

Tip: For enhanced security, consider using Shared Access Signatures (SAS) for temporary, delegated access instead of public access.

Delete a Container

To delete a container and all its blobs, navigate to the container in the Azure portal and select Delete container. You will be prompted to confirm the deletion.

az storage container delete \
    --name mycli-sample-container \
    --account-name mystorageaccountname \
    --auth-mode login
            

Note: Deleting a container is a permanent operation and cannot be undone.

Next Steps

Now that you know how to manage containers, you can start uploading blobs to them. Explore the following topics: