I got interested in Farmer and decided to try it out in my project. I managed to replace most of the ARM template with Farmer.
However, there are Application Insights left, as I have quite a complicated setup there, including some alerts, scheduled query rules and so on. Whereas everything that Farmer currently supports for AI is just name, IP masking and sample percentage.
How can I plug in AI setup into the Farmer so that I don't reject Farmer just because of that part? My service looks like this:
let webApp = webApp {
name appName
service_plan_name servicePlanName
sku WebApp.Sku.B1
always_on
...
}
So webApp
setup has a builder keyword for this, link_to_unmanaged_app_insights
:
Instructs Farmer to link this webapp to an existing app insights instance that is externally managed, rather than creating a new one.
However there are no examples and only one test using it, so after some experimenting, this is what proved to work:
arm-template-ai.json
.let webApp = webApp {
name appName
service_plan_name servicePlanName
sku WebApp.Sku.B1
always_on
link_to_unmanaged_app_insights (ResourceId.create appInsightsName)
}
An example how it can look in Azure DevOps: