Archive a blob

The Archive tier is an offline tier for storing blob data that is rarely accessed. The Archive tier offers the lowest storage costs, but higher data retrieval costs and latency compared to the online tiers (Hot and Cool). Data must remain in the Archive tier for at least 180 days or be subject to an early deletion charge. For more information about the Archive tier, see Archive access tier.

While a blob is in the Archive tier, it can't be read or modified. To read or download a blob in the Archive tier, you must first rehydrate it to an online tier, either Hot or Cool. Data in the Archive tier can take up to 15 hours to rehydrate, depending on the priority you specify for the rehydration operation. For more information about blob rehydration, see Overview of blob rehydration from the Archive tier.

Caution

A blob in the Archive tier is offline — that is, it cannot be read or modified — until it is rehydrated. The rehydration process can take several hours and has associated costs. Before you move data to the Archive tier, consider whether taking blob data offline may affect your workflows.

You can use the Azure portal, PowerShell, Azure CLI, or one of the Azure Storage client libraries to manage data archiving.

Archive blobs on upload

To archive one ore more blobs on upload, create the blob directly in the Archive tier.

To archive a blob or set of blobs on upload from the Azure portal, follow these steps:

  1. Navigate to the target container.

  2. Select the Upload button.

  3. Select the file or files to upload.

  4. Expand the Advanced section, and set the Access tier to Archive.

  5. Select the Upload button.

    Screenshot showing how to upload blobs to the Archive tier in the Azure portal

Archive an existing blob

You can move an existing blob to the Archive tier in one of two ways:

  • You can change a blob's tier with the Set Blob Tier operation. Set Blob Tier moves a single blob from one tier to another.

    Keep in mind that when you move a blob to the Archive tier with Set Blob Tier, then you cannot read or modify the blob's data until you rehydrate the blob. If you may need to read or modify the blob's data before the early deletion interval has elapsed, then consider using a Copy Blob operation to create a copy of the blob in the Archive tier.

  • You can copy a blob in an online tier to the Archive tier with the Copy Blob operation. You can call the Copy Blob operation to copy a blob from an online tier (Hot or Cool) to the Archive tier. The source blob remains in the online tier, and you can continue to read or modify its data in the online tier.

Archive an existing blob by changing its tier

Use the Set Blob Tier operation to move a blob from the Hot or Cool tier to the Archive tier. The Set Blob Tier operation is best for scenarios where you will not need to access the archived data before the early deletion interval has elapsed.

The Set Blob Tier operation changes the tier of a single blob. To move a set of blobs to the Archive tier with optimum performance, Microsoft recommends performing a bulk archive operation. The bulk archive operation sends a batch of Set Blob Tier calls to the service in a single transaction. For more information, see Bulk archive.

To move an existing blob to the Archive tier in the Azure portal, follow these steps:

  1. Navigate to the blob's container.

  2. Select the blob to archive.

  3. Select the Change tier button.

  4. Select Archive from the Access tier dropdown.

  5. Select Save.

    Screenshot showing how to set a blob's tier to Archive in the Azure portal

Archive an existing blob with a copy operation

Use the Copy Blob operation to copy a blob from the Hot or Cool tier to the Archive tier. The source blob remains in the Hot or Cool tier, while the destination blob is created in the Archive tier.

A Copy Blob operation is best for scenarios where you may need to read or modify the archived data before the early deletion interval has elapsed. You can access the source blob's data without needing to rehydrate the archived blob.

N/A

Bulk archive

When moving a large number of blobs to the Archive tier, use a batch operation for optimal performance. A batch operation sends multiple API calls to the service with a single request. The sub-operations supported by the Blob Batch operation include Delete Blob and Set Blob Tier.

To archive blobs with a batch operation, use one of the Azure Storage client libraries. The following code example shows how to perform a basic batch operation with the .NET client library:

static async Task BulkArchiveContainerContents(string accountName, string containerName)
{
    string containerUri = string.Format("https://{0}.blob.core.windows.net/{1}",
                                    accountName,
                                    containerName);

    // Get container client, using Azure AD credentials.
    BlobUriBuilder containerUriBuilder = new BlobUriBuilder(new Uri(containerUri));
    BlobContainerClient blobContainerClient = new BlobContainerClient(containerUriBuilder.ToUri(), 
                                                                      new DefaultAzureCredential());

    // Get URIs for blobs in this container and add to stack.
    var uris = new Stack<Uri>();
    await foreach (var item in blobContainerClient.GetBlobsAsync())
    {
        uris.Push(blobContainerClient.GetBlobClient(item.Name).Uri);
    }

    // Get the blob batch client.
    BlobBatchClient blobBatchClient = blobContainerClient.GetBlobBatchClient();

    try
    {
        // Perform the bulk operation to archive blobs.
        await blobBatchClient.SetBlobsAccessTierAsync(blobUris: uris, accessTier: AccessTier.Archive);
    }
    catch (RequestFailedException e)
    {
        Console.WriteLine(e.Message);
    }
}

For an in-depth sample application that shows how to change tiers with a batch operation, see AzBulkSetBlobTier.

See also