send activity log to LOg analytics workspace

Somnath Shukla 411 Reputation points

I have storage account i wanted to send activity log to Log analytics works space.
i want to use terraform. i can do the same using portal.
when i use the below code
resource "azurerm_monitor_diagnostic_setting" "example" {
name = "example"
target_resource_id =
log_analytics_workspace_id =

dynamic "log" {
for_each = ["AuditEvent"]
content {
category = log.value
enabled = true
retention_policy {
enabled = false

Error creating Monitor Diagnostics Setting "example" for Resource "/subscriptions/{suid}/resourceGroups/vm/providers/Microsoft.Storage/storageAccounts/{storagename}": insights.DiagnosticSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Subscription '--' is not whitelisted in the private preview of diagnostic log settings for Azure resource type '', feature flag: 'microsoft.insights/diagnosticsettingpreview'."

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
34,837 questions
0 comments No comments
{count} votes