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

For azurerm_api_management_diagnostic, Event Hub Configuration not working #19970

Closed
1 task done
sandykardile opened this issue Jan 11, 2023 · 2 comments · Fixed by #23736
Closed
1 task done

For azurerm_api_management_diagnostic, Event Hub Configuration not working #19970

sandykardile opened this issue Jan 11, 2023 · 2 comments · Fixed by #23736

Comments

@sandykardile
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

3.38.0

AzureRM Provider Version

3.38.0

Affected Resource(s)/Data Source(s)

azurerm_api_management_diagnostic

Terraform Configuration Files

resource "azurerm_api_management_logger" "apim" {
  name                = "logger-apim-001"
  api_management_name = azurerm_api_management.apim.name
  resource_group_name = azurerm_resource_group.apim.name

  eventhub {
    name              = "evh-apim-001"
    connection_string = "primary_connection_string"
  }
}

resource "azurerm_api_management_diagnostic" "apim" {
  identifier               = "azuremonitor"
  resource_group_name      = azurerm_resource_group.apimfrc.name
  api_management_name      = azurerm_api_management.apim.name
  api_management_logger_id = azurerm_api_management_logger.apim.id
  always_log_errors        = true
  log_client_ip            = true
  verbosity                = "verbose"
  sampling_percentage      = 100

  frontend_request {
    headers_to_log = [
      "x-appgw-trace-id",
    ]
  }
  frontend_response {
    headers_to_log = [
      "x-appgw-trace-id",
    ]
  }
  backend_request {
    headers_to_log = [
      "x-appgw-trace-id",
    ]
  }
  backend_response {
    headers_to_log = [
      "x-appgw-trace-id",
    ]
  }
}

Debug Output/Panic Output

We are trying to set up an azure monitor for the event hub and the error is on operationNameFormat which is only used in the case of application insight.
Error:
Apimanagement.DiagnosticClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ValidationError" Message="One or more fields contain incorrect values:" Details=[{"code":"ValidationError","message":"Property 'OperationNameFormat' is only supported for Application Insights diagnostics.","target":"operationNameFormat"}]

Expected Behaviour

Azure event hub monitoring could be configured correctly

Actual Behaviour

Error:
Apimanagement.DiagnosticClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ValidationError" Message="One or more fields contain incorrect values:" Details=[{"code":"ValidationError","message":"Property 'OperationNameFormat' is only supported for Application Insights diagnostics.","target":"operationNameFormat"}]

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@ghost
Copy link

ghost commented Apr 4, 2023

This is still an issue with azurerm v3.50. I am not setting event hub details, but it is throwing the same error.

My resource configuration:

resource "azurerm_api_management_diagnostic" "azure_monitor_logger_diagnostic" {
  api_management_logger_id = azurerm_api_management_logger.azure_monitor_logger.id
  api_management_name      = "[apim name]"
  identifier               = "azuremonitor"
  resource_group_name      = local.resource_group_name
  depends_on = [
    azurerm_api_management_logger.azure_monitor_logger,
  ]
}

When I run the script, it says it will create the following:

# azurerm_api_management_diagnostic.azure_monitor_logger_diagnostic will be created
+ resource "azurerm_api_management_diagnostic" "azure_monitor_logger_diagnostic" {
    + always_log_errors         = (known after apply)
    + api_management_logger_id  = "[id]"
    + api_management_name       = "[apim name]"
    + http_correlation_protocol = (known after apply)
    + id                        = (known after apply)
    + identifier                = "azuremonitor"
    + log_client_ip             = (known after apply)
    + operation_name_format     = "Name"
    + resource_group_name       = "[rg name]"
    + sampling_percentage       = (known after apply)
    + verbosity                 = (known after apply)
  }

And the error output is:

│ Error: creating or updating Diagnostic: (Name "azuremonitor" / Service Name "[apim name]" / Resource Group "[rg name]"): apimanagement.DiagnosticClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="ValidationError" Message="One or more fields contain incorrect values:" Details=[{"code":"ValidationError","message":"Property 'OperationNameFormat' is only supported for Application Insights diagnostics.","target":"operationNameFormat"}]

Copy link

github-actions bot commented May 2, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.