Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create monitor diagnostic setting with StorageWrite #10646

Open
neil-yechenwei opened this issue Aug 31, 2020 · 7 comments
Open

Failed to create monitor diagnostic setting with StorageWrite #10646

neil-yechenwei opened this issue Aug 31, 2020 · 7 comments
Labels
DiagnosticSetting Service Attention This issue is responsible by Azure service team. Storage

Comments

@neil-yechenwei
Copy link

Seems it failed to create monitor diagnostic setting with StorageWrite using azure go sdk client and throw below error message.
According by the doc, I assume it has been supported by azure portal. So I assume it should also be supported by rest api, right?

Error message:

Error: Error creating Monitor Diagnostics Setting "storageodgxstor-logs" for Resource "/subscriptions/xx-xx-xx-xx/resourceGroups/storage-odgx/providers/Microsoft.Storage/storageAccounts/storageodgxstor": insights.DiagnosticSettingsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Category 'StorageWrite' is not supported."
@ghost ghost added the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 31, 2020
@raych1 raych1 added Service Attention This issue is responsible by Azure service team. Storage labels Aug 31, 2020
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Aug 31, 2020
@ghost
Copy link

ghost commented Aug 31, 2020

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @xgithubtriage.

@blueww
Copy link
Member

blueww commented Sep 1, 2020

This looks like a DiagnosticSetting API issue instead of storage API issue.
Add "DiagnosticSetting" tag.

@jrauschenbusch
Copy link

any progress here?

@jmkimball55
Copy link

any progress here?

J Kimball - Integration Platforms and Engineering

@ishepherd
Copy link

ishepherd commented May 3, 2021

Error: Error creating Monitor Diagnostics Setting "storageodgxstor-logs" for Resource "/subscriptions/xx-xx-xx-xx/resourceGroups/storage-odgx/providers/Microsoft.Storage/storageAccounts/storageodgxstor": <...snip...> Category 'StorageWrite' is not supported."

Possibly you tried to target the diagnostic setting at the storage account? Microsoft.Storage/storageAccounts resource

Blob diagnostic settings are actually targeted to the Microsoft.Storage/storageAccounts/blobServices resource.

This comment helped me: hashicorp/terraform-provider-azurerm#8275 (comment)

@andaryjo
Copy link

What worked for me is using .../storageAccounts/<account>/blobServices/default as resource ID.

@MarcoCavalazzi
Copy link

Hi guys, to complement @andaryjo's comment, this configuration is working for me:

# Diagnostic settings for the metrics of the storage account.
resource "azurerm_monitor_diagnostic_setting" "storageaccount_diagnostic" {
  name                       = "${var.environment}-${var.storage_account.name}-diagnostic"
  target_resource_id         = azurerm_storage_account.storageaccount.id
  log_analytics_workspace_id = var.loganalytics_workspace_id
  
  # All metrics
  metric {
    category = "Capacity"
    enabled  = true
  }
  metric {
    category = "Transaction"
    enabled  = true
  }
}
# Diagnostic settings (metrics and logs) for the storage account's blob containers. It's configured once to cover all blobs.
resource "azurerm_monitor_diagnostic_setting" "storageaccount_diagnostic_blobs" {
  name                       = "${var.environment}-${var.storage_account.name}-diagnostic-blobs"
  target_resource_id         = "${azurerm_storage_account.storageaccount.id}/blobServices/default/"
  log_analytics_workspace_id = var.loganalytics_workspace_id

  enabled_log {
    category_group = "allLogs"
  }
  
  # All metrics
  metric {
    category = "Capacity"
    enabled  = true
  }
  metric {
    category = "Transaction"
    enabled  = true
  }
}

I did the same for the tables and queues, using an additional resource and changing the target_resource_id reference to:

  • "${azurerm_storage_account.storageaccount[0].id}/tableServices/default/"
  • "${azurerm_storage_account.storageaccount[0].id}/queueServices/default/"

Naturally the variables will need to be updated to reflect your environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DiagnosticSetting Service Attention This issue is responsible by Azure service team. Storage
Projects
None yet
Development

No branches or pull requests

8 participants