Is it possible to set data retention for application-insights using Azure CLI (az)?
Preferably during resource creation with az monitor app-insights component create.
You should use this cli command: az resource update.
The example code:
az resource update --resource-group your_resource_group --name appInsights_name --resource-type "microsoft.insights/components" --set properties.RetentionInDays=180
Test result(you may need to refresh the web page so you can see the new retention value in azure portal.):
Note: The valid value for RetentionInDays should be one of these: 30, 60, 90, 120, 180, 270, 365, 550 or 730. The reference doc is here.