You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-monitor/essentials/migrate-to-azure-storage-lifecycle-policy.md
+120Lines changed: 120 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,8 @@ An existing diagnostic setting logging to a storage account.
32
32
33
33
## Migration Procedures
34
34
35
+
36
+
## [Azure portal](#tab/portal)
35
37
To migrate your diagnostics settings retention rules, follow the steps below:
36
38
37
39
1. Go to the Diagnostic Settings page for your logging resource and locate the diagnostic setting you wish to migrate
@@ -64,6 +66,124 @@ To set the rule for a specific webapp app, use *insights-activity-logs/ResourceI
64
66
1. Select **Add** to save the rule.
65
67
:::image type="content" source="./media/retention-migration/lifecycle-management-add-rule-filter-set.png" lightbox="./media/retention-migration/lifecycle-management-add-rule-filter-set.png" alt-text="A screenshot showing the filters tab for adding a lifecycle rule.":::
66
68
69
+
70
+
## [CLI](#tab/cli)
71
+
72
+
Use the [az storage account management-policy create](https://docs.microsoft.com/cli/azure/storage/account/management-policy?view=azure-cli-latest#az-storage-account-management-policy-create) command to create a lifecycle management policy. You must still set the retention in your diagnostic settings to *0*. See the Azure portal section above for more information.
73
+
74
+
75
+
76
+
```azurecli
77
+
78
+
az storage account management-policy create --account-name <storage account name> --resource-group <resource group name> --policy @<policy definition file>
79
+
```
80
+
81
+
The sample policy definition file below sets the retention for all blobs in the container *insights-activity-logs* for the given subscription ID. For more information, see [Lifecycle management policy definition](https://learn.microsoft.com/azure/storage/blobs/lifecycle-management-overview#lifecycle-management-policy-definition).
Apply the following template to create a lifecycle management policy. You must still set the retention in your diagnostic settings to *0*. See the Azure portal section above for more information.
128
+
129
+
```azurecli
130
+
131
+
az deployment group create --resource-group <resource group name> --template-file <template file>
132
+
133
+
``````
134
+
135
+
The following template sets the retention for storage account *azmonstorageaccount001* for all blobs in the container *insights-activity-logs* for all resources for the subscription ID *ABCD1234-5849-ABCD-1234-9876543210AB*.
0 commit comments