Blobs with Index Tags - How to identify the blobs with blob index tags and how to remove those tags
Background
This article describes how to identify the blobs with index tags and how to remove those tags using the Blob Inventory Service and Python SDK.
Approach
-
Use the Blob Inventory service to identify the blobs with index tags
- You should follow the steps in this section if you want to know/identify which blobs in your Storage Account have index tags, and to know which index tags are associated with them.
-
Remove the Blob Index Tags
- You should follow the steps in this section if you want to remove all index tags from the Blobs under a specific container.
Azure Storage blob inventory provides a list of the containers, blobs, blob versions, and snapshots in your storage account, along with their associated properties. It generates an output report in either comma-separated values (CSV) or Apache Parquet format on a daily or weekly basis. You can use the report to audit retention, legal hold or encryption status of your storage account contents, or you can use it to understand the total data size, age, tier distribution, or other attributes of your data. Please see more information here Azure Storage blob inventory.
The steps to enable inventory report are presented here Enable Azure Storage blob inventory reports.
Please see below how to define a blob inventory rule to search all blobs:
- Open the Blob Inventory area in your storage account
- Add a new inventory rule by filling in the following field
- Rule name: The name of your blob inventory rule
- Container: Container to place inventory file in.
- Object type to inventory: Select blob
- Blob types: Select all [Block blobs, Page blobs, Append blobs]
- Subtypes: Select [Include blob versions, Include snapshots]
- Blob inventory fields: Please see here the Custom schema fields supported for blob inventory
- In this scenario, we need to select at least the following fields [Name, Etag, Snapshot, Current version status, VersionId, Tags, TagCount]
- Inventory frequency: A blob inventory run is automatically scheduled every day when daily is chosen. Selecting weekly schedule will only trigger the inventory run on Sundays.
- In this scenario, to get the results faster, it is better to select daily.
- Export format: The export format. Could be a csv file or a parquet file
- Prefix match: Filter blobs by name or first letters. To find items in a specific container, enter the name of the container followed by a forward slash, then the blob name or first letters. For example, to show all blobs starting with “a”, type: “myContainer/a”.
- Here is the place to add the path where to start collecting the blob information. Could be the container name.
The blob inventory result will have the information as follows:
Support documentation:
- Inventory run - A blob inventory run is automatically scheduled every day. It can take up to 24 hours for an inventory run to complete.
- Since you have a huge number of blobs, this could take more time to run and because of that, it could be better to create a rule for each container. Using a prefix can help achieve this.
- Inventory output - Each inventory rule generates a set of files in the specified inventory destination container for that rule.
- Inventory files - Each inventory run for a rule generates the following files: Inventory file, Checksum file, Manifest file.
- Pricing and billing - Pricing for inventory is based on the number of blobs and containers that are scanned during the billing period.
- Known issues - Please find the kwon issues associated with blob inventory here.
In this section, you can find a script to remove the blob index tags from all the blobs under a specific container using Python SDK.
Please note that once these blob index tags are removed, they cannot be recovered. So, apply these steps only when you are sure that you no longer need to use your blob index tags.
-
- concurrent.futures (more information here concurrent.futures — Launching parallel tasks).
- azure-storage-blob (more information here azure-storage-blob · PyPI).
pip install azure-storage-blob
Sample scripts:
Special notes:
- These scripts were developed and tested using the following versions but it is expected to work with previous versions:
- Python 3.11.5
- azure-storage-blob 12.18.2
- The computer / Virtual Machine (VM) specifications have a significant impact on the script performance.
- Using a VM within the same region of the storage account could also increase the script performance.
If you executed the Blob Inventory Report to identify the blobs with blob index tags (Section 1), you can use the script below (Script 1) to identify the containers with Blobs that have index tags. If you already know the name of the containers, please skip this script.
Script 1
After identifying the containers with Blobs with index tags, you can run the next script below (Script 2) to remove all index tags. We advise you to run the script once for each container. Please note that you can run several script instances in parallel.
Script 2
Disclaimer:
- These steps are provided for the purpose of illustration only.
- These steps and any related information are provided "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.
- We grant You a nonexclusive, royalty-free right to use and modify the Steps and to reproduce and distribute the steps, provided that. You agree:
- to not use Our name, logo, or trademarks to market Your software product in which the steps are embedded;
- to include a valid copyright notice on Your software product in which the steps are embedded; and
- to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of steps.
Published on:
Learn moreRelated posts
Azure Storage - TLS 1.0 and 1.1 retirement
Overview TLS 1.0 and 1.1 retirement on Azure Storage was previously announced for Nov 1st, 2024, and it was postponed recently to 1 year later...
Efficient Management of Append and Page Blobs Using Azure Storage Actions
Overview In Azure Storage, Blob Lifecycle Management (BLM) allows you to automate the management of your data based on rules defined by...
[Azure AI Search] Internal Server Error when creating CMK encrypted objects
Scenario Customers follow the Microsoft doc to create CMK encrypted objects (data source, index etc.), but get the 500 Internal Serv...
Optimizing Azure Table Storage: Automated Data Cleanup using a PowerShell script with Azure Automate
Scenario This blog’s aim is to manage Table Storage data efficiently. Imagine you have a large Azure Table Storage that accumulates logs from ...
Optimizing Azure Table Storage: Automated Data Clean-up using a PowerShell script with Azure Automat
Scenario This blog’s aim is to manage Table Storage data efficiently. Imagine you have a large Azure Table Storage that accumulates logs from ...
Restoring Soft-Deleted Blobs with multithreading in Azure Storage Using C#
Blob soft delete is an essential feature that safeguards your data against accidental deletions or overwrites. By retaining deleted data for a...
Performing simple Azure Table Storage REST API operations using curl command.
The blog provides guidance to perform simple Table Storage REST API operations such as Create table, Delete Table, Insert entity, Delete entit...
Bulk delete all the old jobs from the batch account
Deleting a Job also deletes all Tasks that are part of that Job, and all Job statistics. This also overrides the retention period for Task dat...
Utilizing Azure Storage and Runbooks for scheduled automated backups of Azure SQL Databases
In this article, we are going to provide detailed steps to create a scheduled Azure SQL Database backup to storage account using automation. T...
[Azure Service Bus] JMS messages getting dead-lettered
The article discusses a problem where numerous messages end up in the dead letter queue (DLQ) when the JMS service bus consumer connects to th...