hamin.se
  • About
  • All posts

Azure ARM template Diagnostics - Tue, Dec 5, 2017

Is it even possible to enable Diagnostic Settings at resource creation using a Resource Manager template

ARM templates are terrible. The documentation is terrible. Everything is extremely inconsistent.

  1. You need a workspace
  2. You need to figure out the workspace id. No it’s not parameters(‘workspaceName’).Id because that would be too consistent. It is: /subscriptions//resourceGroups//providers/microsoft.operationalinsights/workspaces/
  3. Resources which need to have diagnostics and / or logging enabled need to have a resource added to them (resource within a resource).
  4. The resource name has to be “Microsoft.Insights/service”
  5. Some resources can have logs. You will need to enable them one by one for each resource. See a list of available logs for each resource here: https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-diagnostic-logs-schema
  6. Most resources have metrics. Find out which resources here: https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftwebsites-excluding-functions
  7. Some resources do not validate with metrics enabled in the template. Why? Unknown.

Don’t try and create the resources manually and enable logging and/or metrics on them by hand to later get the template out of the Automation preferences, no, that template will not give you a single hint of how to enable logging or metrics.

I guess Powershell is the choice for infrastructure as code in Azure.

Back to Home


© 2024 | Built on Hugo

Twitter Linkedin GitHub