Enable Azure Storage blob inventory reports

The Azure Storage blob inventory feature provides an overview of your containers, blobs, snapshots, and blob versions within a storage account. Use the inventory report to understand various attributes of blobs and containers such as your total data size, age, encryption status, immutability policy, and legal hold and so on. The report provides an overview of your data for business and compliance requirements.

To learn more about blob inventory reports, see Azure Storage blob inventory.

Enable blob inventory reports by adding a policy with one or more rules to your storage account. Add, edit, or remove a policy by using the Azure portal.

Enable inventory reports

  1. Sign in to the Azure portal to get started.

  2. Locate your storage account and display the account overview.

  3. Under Data management, select Blob inventory.

  4. Select Add your first inventory rule.

    The Add a rule page appears.

  5. In the Add a rule page, name your new rule.

  6. Choose the container that will store inventory reports.

  7. Under Object type to inventory, choose whether to create a report for blobs or containers.

    If you select Blob, then under Blob subtype, choose the types of blobs that you want to include in your report, and whether to include blob versions and/or snapshots in your inventory report.

    Note

    The option to include blob versions appears only for accounts that don't have the hierarchical namespace feature enabled. Versions and snapshots must be enabled on the account to save a new rule with the corresponding option enabled.

  8. Select the fields that you would like to include in your report, and the format of your reports.

  9. Choose how often you want to generate reports.

  10. Optionally, add a prefix match to filter blobs in your inventory report.

  11. Select Save.

    Screenshot showing how to add a blob inventory rule by using the Azure portal.

Disable inventory reports

While you can disable individual reports, you can also prevent blob inventory from running at all.

  1. Sign in to the Azure portal.

  2. Locate your storage account and display the account overview.

  3. Under Data management, select Blob inventory.

  4. Select Blob inventory settings, and in the Blob inventory settings pane, clear the Enable blob inventory checkbox, and then select Save.

    Screenshot showing the Enable blob inventory checkbox in the Azure portal.

    Clearing the Enable blob inventory checkbox suspends all blob inventory runs. You can select this checkbox later if you want to resume inventory runs.

Subscribe to blob inventory policy completed event

You can suscribe to blob inventory completed event to receive information on the outcome of your inventory runs. This event gets triggered when the inventory run completes for a rule that is defined an inventory policy. This event also occurs if the inventory run fails with a user error before it starts to run. For example, an invalid policy, or an error that occurs when a destination container isn't present will trigger the event.

  1. Sign in to the Azure portal.

  2. Locate your storage account and display the account overview.

  3. In the left menu, select Events.

  4. Select + Event Subscription.

    The Create Event Subscription page appears.

  5. In the Create Event Subscription page, name your event subscription and use default schema, Event Grid Schema.

  6. Under EVENT TYPES, choose Blob Inventory Completed.

  7. Under ENDPOINT DETAILS, choose Storage Queue as the Endpoint Type and select Configure an endpoint.

  8. In the Queues page, choose the subscription, the storage account and create a new queue. Name your queue then click Create.

  9. Optionally, select the Filters tab if you want to filter the subject of the event or its attributes.

  10. Optionally, select the Additional Features tab if you want to enable dead-lettering, retry policies and set event subscription expiration time.

  11. Optionally, select Delivery Properties tab to set the storage queue message time to live.

  12. Select Create

To view the delivered queue messages

  1. Locate your storage account and display the account overview.

  2. Under Data Storage, select Queues and open the newly create queue used to configure the endpoint to access the messages.

  3. Select the message for the desired inventory run time to access the message properties the review the message body for the event status.

For more methods on how to subscribe to blob storage events, see Azure Blob Storage as Event Grid source - Azure Event Grid | Microsoft Learn

Optionally enable access time tracking

You can choose to enable blob access time tracking. When access time tracking is enabled, inventory reports will include the LastAccessTime field based on the time that the blob was last accessed with a read or write operation. To minimize the effect on read access latency, only the first read of the last 24 hours updates the last access time. Subsequent reads in the same 24-hour period don't update the last access time. If a blob is modified between reads, the last access time is the more recent of the two values.

To enable last access time tracking with the Azure portal, follow these steps:

  1. Sign in to the Azure portal.

  2. Locate your storage account and display the account overview.

  3. Under Data management, select Blob inventory.

  4. Select Blob inventory settings, and in the Blob inventory settings pane, select the Enable last access tracking checkbox.

    Screenshot showing how to enable last access time tracking of the blob inventory settings by using the Azure portal.

Next steps