send activity log to LOg analytics workspace

Somnath Shukla 411 Reputation points
2020-10-06T09:44:54.187+00:00

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 = data.azurerm_storage_account.example.id
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.log.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 'microsoft.storage/storageaccounts', feature flag: 'microsoft.insights/diagnosticsettingpreview'."

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