Skip to content

Commit 5c0cef5

Browse files
Merge pull request #274157 from normesta/inventory
Updating inventory docs to include last access time tracking and enab…
2 parents 2b3f88d + 3f51b54 commit 5c0cef5

9 files changed

+112
-39
lines changed

articles/storage/blobs/blob-inventory-how-to.md

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ services: storage
55
author: normesta
66

77
ms.service: azure-blob-storage
8-
ms.date: 02/24/2023
8+
ms.date: 05/02/2024
99
ms.topic: how-to
1010
ms.author: normesta
11-
ms.reviewer: klaasl
1211
ms.devlang: powershell
1312
# ms.devlang: powershell, azurecli
1413
ms.custom: devx-track-azurepowershell, devx-track-azurecli
@@ -51,11 +50,12 @@ Enable blob inventory reports by adding a policy with one or more rules to your
5150

5251
9. Choose how often you want to generate reports.
5352

54-
9. Optionally, add a prefix match to filter blobs in your inventory report.
53+
10. Optionally, add a prefix match to filter blobs in your inventory report.
5554

56-
10. Select **Save**.
55+
11. Select **Save**.
5756

58-
:::image type="content" source="./media/blob-inventory-how-to/portal-blob-inventory.png" alt-text="Screenshot showing how to add a blob inventory rule by using the Azure portal":::
57+
> [!div class="mx-imgBorder"]
58+
> ![Screenshot showing how to add a blob inventory rule by using the Azure portal.](./media/blob-inventory-how-to/portal-blob-inventory.png)
5959
6060
### [PowerShell](#tab/azure-powershell)
6161

@@ -188,6 +188,52 @@ You can add, edit, or remove a policy via the [Azure CLI](/cli/azure/).
188188

189189
---
190190

191+
## Disable inventory reports
192+
193+
While you can disable individual reports, you can also prevent blob inventory from running at all.
194+
195+
1. Sign in to the [Azure portal](https://portal.azure.com/).
196+
197+
2. Locate your storage account and display the account overview.
198+
199+
3. Under **Data management**, select **Blob inventory**.
200+
201+
4. Select **Blob inventory settings**, and in the **Blob inventory settings** pane, clear the **Enable blob inventory** checkbox, and then select **Save**.
202+
203+
> [!div class="mx-imgBorder"]
204+
> ![Screenshot showing the Enable blob inventory checkbox in the Azure portal.](./media/blob-inventory-how-to/portal-blob-inventory-disable.png)
205+
206+
Clearing the **Enable blob inventory** checkbox suspends all blob inventory runs. You can select this checkbox later if you want to resume inventory runs.
207+
208+
## Optionally enable access time tracking
209+
210+
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.
211+
212+
### [Portal](#tab/azure-portal)
213+
214+
To enable last access time tracking with the Azure portal, follow these steps:
215+
216+
1. Sign in to the [Azure portal](https://portal.azure.com/).
217+
218+
2. Locate your storage account and display the account overview.
219+
220+
3. Under **Data management**, select **Blob inventory**.
221+
222+
4. Select **Blob inventory settings**, and in the **Blob inventory settings** pane, select the **Enable last access tracking** checkbox.
223+
224+
> [!div class="mx-imgBorder"]
225+
> ![Screenshot showing how to enable last access time tracking of the blob inventory settings by using the Azure portal.](./media/blob-inventory-how-to/portal-blob-inventory-last-access-time.png)
226+
227+
### [PowerShell](#tab/azure-powershell)
228+
229+
[!INCLUDE [azure-storage-set-last-access-time-powershell](../../../includes/azure-storage-set-last-access-time-powershell.md)]
230+
231+
### [Azure CLI](#tab/azure-cli)
232+
233+
[!INCLUDE [azure-storage-set-last-access-time-azure-cli](../../../includes/azure-storage-set-last-access-time-azure-cli.md)]
234+
235+
---
236+
191237
## Next steps
192238

193239
- [Calculate the count and total size of blobs per container](calculate-blob-count-size.yml)

articles/storage/blobs/blob-inventory.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Each rule within the policy has several parameters:
9494
| name | string | A rule name can include up to 256 case-sensitive alphanumeric characters. The name must be unique within a policy. | Yes |
9595
| enabled | boolean | A flag allowing a rule to be enabled or disabled. The default value is **true**. | Yes |
9696
| definition | JSON inventory rule definition | Each definition is made up of a rule filter set. | Yes |
97-
| destination | string | The destination container where all inventory files will be generated. The destination container must already exist. |
97+
| destination | string | The destination container where all inventory files are generated. The destination container must already exist. |
9898

9999
The global **Blob inventory enabled** flag takes precedence over the *enabled* parameter in a rule.
100100

@@ -115,7 +115,7 @@ Several filters are available for customizing a blob inventory report:
115115
| Filter name | Filter type | Notes | Required? |
116116
|--|--|--|--|
117117
| blobTypes | Array of predefined enum values | Valid values are `blockBlob` and `appendBlob` for hierarchical namespace enabled accounts, and `blockBlob`, `appendBlob`, and `pageBlob` for other accounts. This field isn't applicable for inventory on a container, (objectType: `container`). | Yes |
118-
| creationTime | Number | Specifies the number of days ago within which the blob must have been created. For example, a value of `3` includes in the report only those blobs which were created in the last 3 days. | No |
118+
| creationTime | Number | Specifies the number of days ago within which the blob must have been created. For example, a value of `3` includes in the report only those blobs, which were created in the last three days. | No |
119119
| prefixMatch | Array of up to 10 strings for prefixes to be matched. | If you don't define *prefixMatch* or provide an empty prefix, the rule applies to all blobs within the storage account. A prefix must be a container name prefix or a container name. For example, `container`, `container1/foo`. | No |
120120
| excludePrefix | Array of up to 10 strings for prefixes to be excluded. | Specifies the blob paths to exclude from the inventory report.<br><br>An *excludePrefix* must be a container name prefix or a container name. An empty *excludePrefix* would mean that all blobs with names matching any *prefixMatch* string will be listed.<br><br>If you want to include a certain prefix, but exclude some specific subset from it, then you could use the excludePrefix filter. For example, if you want to include all blobs under `container-a` except those under the folder `container-a/folder`, then *prefixMatch* should be set to `container-a` and *excludePrefix* should be set to `container-a/folder`. | No |
121121
| includeSnapshots | boolean | Specifies whether the inventory should include snapshots. Default is `false`. This field isn't applicable for inventory on a container, (objectType: `container`). | No |
@@ -227,7 +227,7 @@ View the JSON for inventory rules by selecting the **Code view** tab in the **Bl
227227
| IncrementalCopy | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
228228
| x-ms-blob-sequence-number | ![Yes](../media/icons/yes-icon.png) | ![No](../media/icons/no-icon.png) |
229229

230-
<sup>1</sup> Disabled by default. [Optionally enable access time tracking](lifecycle-management-policy-configure.md#optionally-enable-access-time-tracking).
230+
<sup>1</sup> Disabled by default. [Optionally enable access time tracking](blob-inventory-how-to.md#optionally-enable-access-time-tracking).
231231

232232
### Custom schema fields supported for container inventory
233233

@@ -249,8 +249,8 @@ View the JSON for inventory rules by selecting the **Code view** tab in the **Bl
249249
| HasImmutabilityPolicy | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
250250
| HasLegalHold | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
251251
| ImmutableStorageWithVersioningEnabled | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
252-
| Deleted (Will appear only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
253-
| Version (Will appear only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
252+
| Deleted (Appears only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
253+
| Version (Appears only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
254254
| DeletedTime (Will appear only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
255255
| RemainingRetentionDays (Will appear only if include deleted containers is selected) | ![Yes](../media/icons/yes-icon.png) | ![Yes](../media/icons/yes-icon.png) |
256256

@@ -415,7 +415,7 @@ An inventory job can take a longer amount of time in these cases:
415415

416416
An inventory job might take more than one day to complete for hierarchical namespace enabled accounts that have hundreds of millions of blobs. Sometimes the inventory job fails and doesn't create an inventory file. If a job doesn't complete successfully, check subsequent jobs to see if they're complete before contacting support.
417417

418-
- There is no option to generate a report retrospectively for a particular date.
418+
- There's no option to generate a report retrospectively for a particular date.
419419

420420
### Inventory jobs can't write reports to containers that have an object replication policy
421421

@@ -427,7 +427,7 @@ You can't configure an inventory policy in the account if support for version-le
427427

428428
### Reports might exclude soft-deleted blobs in accounts that have a hierarchical namespace
429429

430-
If a container or directory is deleted with soft-delete enabled, then the container or directory and all its contents are marked as soft-deleted. However, only the container or directory (reported as a zero-length blob) appears in an inventory report and not the soft-deleted blobs in that container or directory even if you set the `includeDeleted` field of the policy to **true**. This can lead to a difference between what appears in capacity metrics that you obtain in the Azure Portal and what is reported by an inventory report.
430+
If a container or directory is deleted with soft-delete enabled, then the container or directory and all its contents are marked as soft-deleted. However, only the container or directory (reported as a zero-length blob) appears in an inventory report and not the soft-deleted blobs in that container or directory even if you set the `includeDeleted` field of the policy to **true**. This can lead to a difference between what appears in capacity metrics that you obtain in the Azure portal and what is reported by an inventory report.
431431

432432
Only blobs that are explicitly deleted appear in reports. Therefore, to obtain a complete listing of all soft-deleted blobs (directory and all child blobs), workloads should delete each blob in a directory before deleting the directory itself.
433433

articles/storage/blobs/lifecycle-management-policy-configure.md

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ A lifecycle management policy is composed of one or more rules that define a set
2323
- The number of days since the blob was last modified.
2424
- The number of days since the blob was last accessed. To use this condition in an action, you should first [optionally enable last access time tracking](#optionally-enable-access-time-tracking).
2525

26-
When the selected condition is true, then the management policy performs the specified action. For example, if you have defined an action to move a blob from the hot tier to the cool tier if it has not been modified for 30 days, then the lifecycle management policy will move the blob 30 days after the last write operation to that blob.
26+
When the selected condition is true, then the management policy performs the specified action. For example, if you have defined an action to move a blob from the hot tier to the cool tier if it hasn't been modified for 30 days, then the lifecycle management policy will move the blob 30 days after the last write operation to that blob.
2727

2828
For a blob snapshot or version, the condition that is checked is the number of days since the snapshot or version was created.
2929

3030
## Optionally enable access time tracking
3131

3232
Before you configure a lifecycle management policy, you can choose to enable blob access time tracking. When access time tracking is enabled, a lifecycle management policy can include an action 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.
3333

34-
If [last access time tracking](lifecycle-management-overview.md#move-data-based-on-last-accessed-time) is not enabled, **daysAfterLastAccessTimeGreaterThan** uses the date the lifecycle policy was enabled instead of the `LastAccessTime` property of the blob. This date is also used when the `LastAccessTime` property is a null value. For more information about using last access time tracking, see [Move data based on last accessed time](lifecycle-management-overview.md#move-data-based-on-last-accessed-time).
34+
If [last access time tracking](lifecycle-management-overview.md#move-data-based-on-last-accessed-time) isn't enabled, **daysAfterLastAccessTimeGreaterThan** uses the date the lifecycle policy was enabled instead of the `LastAccessTime` property of the blob. This date is also used when the `LastAccessTime` property is a null value. For more information about using last access time tracking, see [Move data based on last accessed time](lifecycle-management-overview.md#move-data-based-on-last-accessed-time).
3535

36-
#### [Portal](#tab/azure-portal)
36+
### [Portal](#tab/azure-portal)
3737

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

@@ -44,34 +44,17 @@ To enable last access time tracking with the Azure portal, follow these steps:
4444
> [!div class="mx-imgBorder"]
4545
> ![Screenshot showing how to enable last access tracking in Azure portal.](media/lifecycle-management-policy-configure/last-access-tracking-enable.png)
4646
47-
#### [PowerShell](#tab/azure-powershell)
47+
### [PowerShell](#tab/azure-powershell)
4848

49-
To enable last access time tracking with PowerShell, call the [Enable-AzStorageBlobLastAccessTimeTracking](/powershell/module/az.storage/enable-azstoragebloblastaccesstimetracking) command, as shown in the following example. Remember to replace placeholder values in angle brackets with your own values:
49+
[!INCLUDE [azure-storage-set-last-access-time-powershell](../../../includes/azure-storage-set-last-access-time-powershell.md)]
5050

51-
```powershell
52-
# Initialize these variables with your values.
53-
$rgName = "<resource-group>"
54-
$accountName = "<storage-account>"
51+
### [Azure CLI](#tab/azure-cli)
5552

56-
Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName $rgName `
57-
-StorageAccountName $accountName `
58-
-PassThru
59-
```
60-
61-
#### [Azure CLI](#tab/azure-cli)
53+
[!INCLUDE [azure-storage-set-last-access-time-azure-cli](../../../includes/azure-storage-set-last-access-time-azure-cli.md)]
6254

63-
To enable last access time tracking with Azure CLI, call the [az storage account blob-service-properties update](/cli/azure/storage/account/blob-service-properties#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:
64-
65-
```azurecli
66-
az storage account blob-service-properties update \
67-
--resource-group <resource-group> \
68-
--account-name <storage-account> \
69-
--enable-last-access-tracking true
70-
```
71-
72-
# [Template](#tab/template)
55+
### [Template](#tab/template)
7356

74-
To enable last access time tracking for a new or existing storage account with an Azure Resource Manager template, include the **lastAccessTimeTrackingPolicy** object in the template definition. For details, see the [Microsoft.Storage/storageAccounts/blobServices 2021-02-01 - Bicep & ARM template reference](/azure/templates/microsoft.storage/2021-02-01/storageaccounts/blobservices?tabs=json). The **lastAccessTimeTrackingPolicy** object is available in the Azure Storage Resource Provider REST API for versions 2019-06-01 and later.
57+
[!INCLUDE [azure-storage-set-last-access-time-template](../../../includes/azure-storage-set-last-access-time-template.md)]
7558

7659
---
7760

@@ -110,7 +93,7 @@ There are two ways to add a policy through the Azure portal.
11093

11194
1. Select **Add** to add the new policy.
11295

113-
Keep in mind that a lifecycle management policy will not delete the current version of a blob until any previous versions or snapshots associated with that blob have been deleted. If blobs in your storage account have previous versions or snapshots, then you should select **Base blobs**, **Snapshots**, and **Versions** in the **Blob Subtype** section when you are specifying a delete action as part of the policy.
96+
Keep in mind that a lifecycle management policy won't delete the current version of a blob until any previous versions or snapshots associated with that blob are deleted. If blobs in your storage account have previous versions or snapshots, then you should select **Base blobs**, **Snapshots**, and **Versions** in the **Blob Subtype** section when you're specifying a delete action as part of the policy.
11497

11598
#### Code view
11699

152 KB
Loading
149 KB
Loading
133 KB
Loading
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
author: normesta
3+
ms.service: storage
4+
ms.topic: include
5+
ms.date: 05/02/2024
6+
ms.author: normesta
7+
---
8+
9+
To enable last access time tracking with Azure CLI, call the [az storage account blob-service-properties update](/cli/azure/storage/account/blob-service-properties#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:
10+
11+
```azurecli
12+
az storage account blob-service-properties update \
13+
--resource-group <resource-group> \
14+
--account-name <storage-account> \
15+
--enable-last-access-tracking true
16+
```
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
author: normesta
3+
ms.service: storage
4+
ms.topic: include
5+
ms.date: 05/02/2024
6+
ms.author: normesta
7+
---
8+
9+
To enable last access time tracking with PowerShell, call the [Enable-AzStorageBlobLastAccessTimeTracking](/powershell/module/az.storage/enable-azstoragebloblastaccesstimetracking) command, as shown in the following example. Remember to replace placeholder values in angle brackets with your own values:
10+
11+
```powershell
12+
# Initialize these variables with your values.
13+
$rgName = "<resource-group>"
14+
$accountName = "<storage-account>"
15+
16+
Enable-AzStorageBlobLastAccessTimeTracking -ResourceGroupName $rgName `
17+
-StorageAccountName $accountName `
18+
-PassThru
19+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: normesta
3+
ms.service: storage
4+
ms.topic: include
5+
ms.date: 05/02/2024
6+
ms.author: normesta
7+
---
8+
9+
To enable last access time tracking for a new or existing storage account with an Azure Resource Manager template, include the **lastAccessTimeTrackingPolicy** object in the template definition. For details, see the [Microsoft.Storage/storageAccounts/blobServices 2021-02-01 - Bicep & ARM template reference](/azure/templates/microsoft.storage/2021-02-01/storageaccounts/blobservices?tabs=json). The **lastAccessTimeTrackingPolicy** object is available in the Azure Storage Resource Provider REST API for versions 2019-06-01 and later.

0 commit comments

Comments
 (0)