是否可以使用Azure CLI(az)为应用程序设置数据保留?
最好在使用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。