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.
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.
Locate your storage account and display the account overview.
Under Data management, select Blob inventory.
Select Add your first inventory rule.
The Add a rule page appears.
In the Add a rule page, name your new rule.
Choose the container that will store inventory reports.
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.
Select the fields that you would like to include in your report, and the format of your reports.
Choose how often you want to generate reports.
Optionally, add a prefix match to filter blobs in your inventory report.
Select Save.
You can add, edit, or remove a policy by using the Azure PowerShell module.
Create a blob inventory policy by using the az storage account blob-inventory-policy create command. Provide the name of your JSON document by using the --policy parameter.
Locate your storage account and display the account overview.
Under Data management, select Blob inventory.
Select Blob inventory settings, and in the Blob inventory settings pane, clear the Enable blob inventory checkbox, and then select Save.
Clearing the Enable blob inventory checkbox suspends all blob inventory runs. You can select this checkbox later if you want to resume inventory runs.
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.
Locate your storage account and display the account overview.
Under Data management, select Blob inventory.
Select Blob inventory settings, and in the Blob inventory settings pane, select the Enable last access tracking checkbox.
To enable last access time tracking with PowerShell, call the Enable-AzStorageBlobLastAccessTimeTracking command, as shown in the following example. Remember to replace placeholder values in angle brackets with your own values:
# Initialize these variables with your values.
$rgName = "<resource-group>"
$accountName = "<storage-account>"
Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName $rgName `
-StorageAccountName $accountName `
-PassThru
To enable last access time tracking with Azure CLI, call the az storage account blob-service-properties update command, as shown in the following example. Remember to replace placeholder values in angle brackets with your own values: