Set a blob's access tier

You can set a blob's access tier in any of the following ways:

  • By setting the default online access tier for the storage account. Blobs in the account inherit this access tier unless you explicitly override the setting for an individual blob.
  • By explicitly setting a blob's tier on upload. You can create a blob in the hot, cool, cold, or archive tier.
  • By changing an existing blob's tier with a Set Blob Tier operation. Typically, you would use this operation to move from a hotter tier to a cooler one.
  • By copying a blob with a Copy Blob operation. Typically, you would use this operation to move from a cooler tier to a hotter one.

This article describes how to manage a blob in an online access tier. For more information about how to move a blob to the archive tier, see Archive a blob. For more information about how to rehydrate a blob from the archive tier, see Rehydrate an archived blob to an online tier.

For more information about access tiers for blobs, see Access tiers for blob data.

Set the default access tier for a storage account

The default access tier setting for a general-purpose v2 storage account determines in which online tier a new blob is created by default. You can set the default access tier for a general-purpose v2 storage account at the time that you create the account or by updating an existing account's configuration.

When you change the default access tier setting for an existing general-purpose v2 storage account, the change applies to all blobs in the account for which an access tier hasn't been explicitly set. Changing the default access tier may have a billing impact. For details, see Default account access tier setting.

To set the default access tier for a storage account at create time in the Azure portal, follow these steps:

  1. Navigate to the Storage accounts page, and select the Create button.

  2. Fill out the Basics tab.

  3. On the Advanced tab, under Blob storage, set the Access tier to either Hot, Cool or Cold. The default setting is Hot.

  4. Select Review + Create to validate your settings and create your storage account.

    Screenshot showing how to set the default access tier when creating a storage account.

To update the default access tier for an existing storage account in the Azure portal, follow these steps:

  1. Navigate to the storage account in the Azure portal.

  2. Under Settings, select Configuration.

  3. Locate the Blob access tier (default) setting, and select either Hot, Cool, or Cold. The default setting is Hot, if you have not previously set this property.

  4. Save your changes.

Set a blob's tier on upload

When you upload a blob to Azure Storage, you have two options for setting the blob's tier on upload:

  • You can explicitly specify the tier in which the blob will be created. This setting overrides the default access tier for the storage account. You can set the tier for a blob or set of blobs on upload to hot, cool, cold or archive.
  • You can upload a blob without specifying a tier. In this case, the blob will be created in the default access tier specified for the storage account (either hot or cool).

If you are uploading a new blob that uses an encryption scope, you cannot change the access tier for that blob.

The following sections describe how to specify that a blob is uploaded to either the hot or cool tier. For more information about archiving a blob on upload, see Archive blobs on upload.

Upload a blob to a specific online tier

To create a blob in the hot, cool, or cold tier, specify that tier when you create the blob. The access tier specified on upload overrides the default access tier for the storage account.

To upload a blob or set of blobs to a specific tier 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 Hot or Cool.

  5. Select the Upload button.

    Screenshot showing how to upload blobs to an online tier in the Azure portal.

Upload a blob to the default tier

Storage accounts have a default access tier setting that indicates in which online tier a new blob is created. The default access tier setting can be set to either hot or cool. The behavior of this setting is slightly different depending on the type of storage account:

  • The default access tier for a new general-purpose v2 storage account is set to the hot tier by default. You can change the default access tier setting when you create a storage account or after it's created.
  • When you create a legacy Blob Storage account, you must specify the default access tier setting as hot or cool when you create the storage account. You can change the default access tier setting for the storage account after it's created.

A blob that doesn't have an explicitly assigned tier infers its tier from the default account access tier setting. You can determine whether a blob's access tier is inferred by using the Azure portal, PowerShell, or Azure CLI.

If a blob's access tier is inferred from the default account access tier setting, then the Azure portal displays the access tier as Hot (inferred), Cool (inferred), or Cold (inferred).

Screenshot showing blobs with the default access tier in the Azure portal.

Move a blob to a different online tier

You can move a blob to a different online tier in one of two ways:

  • By changing the access tier.
  • By copying the blob to a different online tier.

For more information about each of these options, see Setting or changing a blob's tier.

Use PowerShell, Azure CLI, AzCopy v10, or one of the Azure Storage client libraries to move a blob to a different tier.

Change a blob's tier

When you change a blob's tier, you move that blob and all of its data to the target tier by calling the Set Blob Tier operation (either directly or via a lifecycle management policy), or by using the azcopy set-properties command with AzCopy. This option is typically the best when you're changing a blob's tier from a hotter tier to a cooler one.

To change a blob's tier to a cooler tier in the Azure portal, follow these steps:

  1. Navigate to the blob for which you want to change the tier.

  2. Select the blob, then select the Change tier button.

  3. In the Change tier dialog, select the target tier.

  4. Select the Save button.

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

Copy a blob to a different online tier

Call Copy Blob operation to copy a blob from one tier to another. When you copy a blob to a different tier, you move that blob and all of its data to the target tier. The source blob remains in the original tier, and a new blob is created in the target tier. Calling Copy Blob is recommended for most scenarios where you're moving a blob to a warmer tier, or rehydrating a blob from the archive tier.

N/A

Bulk tiering

To move blobs to another tier in a container or a folder, enumerate blobs and call the Set Blob Tier operation on each one. The following example shows how to perform this operation:

N/A

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

To change access tier of 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.chinacloudapi.cn/{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.

Next steps