使用 Azure CLI 为 application-insights 设置数据保留

Set data retention for application-insights using Azure CLI

是否可以使用 Azure CLI (az) 为 application-insights 设置数据保留?

最好在使用 az monitor app-insights component create 创建资源期间。

您应该使用此 cli 命令:az resource update

示例代码:

az resource update --resource-group your_resource_group --name appInsights_name --resource-type "microsoft.insights/components" --set properties.RetentionInDays=180

测试结果(您可能需要刷新网页以便您可以在 Azure 门户中看到新的保留值。):

注意: RetentionInDays 的有效值应为以下之一:30, 60, 90, 120, 180, 270, 365, 550 or 730。参考文档是 here.