Interview Prep/Azure/Storage, Key Vault and Monitoring

What are diagnostic settings and how do you enforce them at scale?

IntermediateConceptStorage, Key Vault and Monitoring
Answer

A diagnostic setting on a resource routes its resource logs and metrics to Log Analytics, storage, Event Hubs or a partner solution. Without one, most resource logs are simply not kept.

az monitor diagnostic-settings create -n to-law --resource <kvId> \
  --workspace <lawId> --logs '[{"categoryGroup":"audit","enabled":true}]' \
  --metrics '[{"category":"AllMetrics","enabled":true}]'

At scale, assign the built-in "Enable allLogs/audit category group resource logging to Log Analytics" policy initiatives (DeployIfNotExists) at management group scope.

Azure All Azure questions Roadmap: Azure core services

More on Storage, Key Vault and Monitoring