azure-databricksazure-rm-templateazure-diagnostics

ARM template for Azure Data Bricks Diagnostic settings


I am able to configure diagnostic settings for azure data bricks in the portal,I need a ARM template to automate the creation of diagnostic settings for azure data bricks.

let me know if any additional information required from my side.

Thanks in advance


Solution

  • Diagnostic settings for Azure Databricks Workspace are configured separately from its creation - you can use standard ARM templates for Azure Monitor that you can find in the documentation. You just need to select what category of diagnostic you want to enable, and modify ARM template correspondingly (the full list of categories could be found in the UI, here is the partial list: "dbfs", "clusters", "accounts", "jobs", "notebook", "ssh", "workspace", "secrets", "sqlPermissions", "instancePools").

    If you're able to use Terraform, you can enable diagnostic settings via it as well, with something like this:

    data "azurerm_databricks_workspace" "example" {
      name                = var.workspace_name
      resource_group_name = var.resource_group
    }
    
    data "azurerm_eventhub_namespace_authorization_rule" "test" {
      name                = "test"
      resource_group_name = var.resource_group
      namespace_name      = var.evhub_ns_name
    }
    
    resource "azurerm_monitor_diagnostic_setting" "test" {
      name               = "test"
      target_resource_id = data.azurerm_databricks_workspace.example.id
      eventhub_authorization_rule_id = data.azurerm_eventhub_namespace_authorization_rule.test.id
      eventhub_name = var.evhub_name
    
      dynamic "log" {
        for_each = var.enabled_log_types
        content {
          category = log.value
          enabled = true
        }
      } 
    }
    
    variable resource_group {
      type        = string
      description = "Resource group to deploy"
    }
    
    variable region {
      type        = string
      description = "Region to deploy"
    }
    
    variable evhub_ns_name {
      type        = string
      description = "Name of eventhub namespace"
    }
    
    variable evhub_name {
      type        = string
      description = "Name of EventHubs topic"
    }
    
    variable workspace_name {
      type = string
      description = "The name of DB Workspace"
    }
    
    variable enabled_log_types {
      type        = list(string)
      description = "List of the log types to enable"
      default     = ["dbfs", "clusters", "accounts", "jobs", "notebook", "ssh",
        "workspace", "secrets", "sqlPermissions", "instancePools"]
    }