How do I configure diagnostics settings for Activity Monitor?

How do I configure diagnostics settings for Activity Monitor within Azure Monitor using Terraform azurerm?
Please let me know how I can get the same settings as in the attached image.

Azure
Monitor→Activity log→Export Activity Logs→Diagnostic settings

Hi @N.Owada,

In this instance the target_resource_id value needs to be set to the resource ID of the subscription

resource "azurerm_monitor_diagnostic_setting" "example" {
  name               = "example"
  target_resource_id = "/subscriptions/5d4b09de-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  storage_account_id = azurerm_storage_account.example.id

  enabled_log {
    category = "Administrative"
  }
  enabled_log {
    category = "Security"
  }
  enabled_log {
    category = "ServiceHealth"
  }
  # ... add/remove enabled_log blocks as required.
}

Hope that helps.

Happy Terraforming

1 Like

@ExtelligenceIT
Thank you for your response.
I tried this method and it worked correctly and solved the problem.

Sincerely,

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.