EventHubValidationErrorFound 映射不存在

问题描述 投票:0回答:1

我在部署下面的模板和参数时遇到此错误:

错误: 代码:EventHubValidationErrorFound 消息:[BadRequest] 发现验证错误:映射不存在

基本上我想做的是使用 ARM 模板部署在给定的 Kusto 集群上创建数据连接 Even Grid。

我有这个ARM模板:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "kustoclusterName": {
      "type": "string"
    },
    "kustoDbName": {
      "type": "string"
    },
    "dataFormatType": {
      "type": "string",
      "defaultValue": "json"
    },
    "kustoDataConnectionsName": {
      "type": "string"
    },
    "subscriptionId": {
      "type": "string",
      "defaultValue": "[subscription().subscriptionId]"
    },
    "resourceGroup": {
      "type": "string",
      "defaultValue": "[resourceGroup().name]"
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]"
    },
    "dpuMI": {
      "type": "string"
    },
    "kind": {
      "type": "string",
      "allowedValues": [
        "EventHub",
        "EventGrid"
      ]
    },
    "eventHubNamespace": {
      "type": "string"
    },
    "eventHub": {
      "type": "string"
    },
    "eventHubSubscriptionId": {
      "type": "string",
      "defaultValue": "[subscription().subscriptionId]"
    },
    "eventHubResourceGroupName": {
      "type": "string",
      "defaultValue": "[resourceGroup().name]"
    },
    "consumergroup": {
      "type": "string",
      "defaultValue": "$Default"
    },
    "storageAccountName": {
      "type": "string"
    },
    "mappingRuleName": {
      "type": "string"
    },
    "tableName": {
      "type": "string"
    },
    "dataFormat": {
      "type": "string",
      "allowedValues": [
        "JSON",
        "MULTIJSON",
        "CSV",
        "PARQUET"
      ]
    },
    "description": {
      "type": "string",
      "defaultValue": ""
    }
  },
  "variables": {},
  "resources": [
    {
      "condition": "[equals(parameters('kind'), 'EventHub')]",
      "type": "Microsoft.Kusto/clusters/databases/dataConnections",
      "apiVersion": "2021-08-27",
      "name": "[concat(parameters('kustoclusterName'), '/', parameters('kustoDbName'), '/', parameters('kustoDataConnectionsName'))]",
      "location": "[parameters('location')]",
      "kind": "[parameters('kind')]",
      "properties": {
        "managedIdentityResourceId": "[parameters('dpuMI')]",
        "eventHubResourceId": "[resourceId(parameters('eventHubSubscriptionId'), parameters('eventHubResourceGroupName'), 'Microsoft.EventHub/namespaces/eventhubs', parameters('eventHubNamespace'), parameters('eventHub'))]",
        "consumerGroup": "[parameters('consumergroup')]"
      },
      "tags": {
        "Version": "0.0.0.0",
        "Description": "[parameters('description')]"
      }
    },
    {
      "condition": "[equals(parameters('kind'), 'EventGrid')]",
      "type": "Microsoft.Kusto/clusters/databases/dataConnections",
      "apiVersion": "2021-08-27",
      "name": "[concat(parameters('kustoclusterName'), '/', parameters('kustoDbName'), '/eg', parameters('kustoDataConnectionsName'))]",
      "location": "[parameters('location')]",
      "kind": "[parameters('kind')]",
      "properties": {
        "ignoreFirstRecord": "[equals(parameters('dataFormat'), 'CSV')]",
        "storageAccountResourceId": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
        "managedIdentityResourceId": "[parameters('dpuMI')]",
        "eventHubResourceId": "[resourceId(parameters('subscriptionId'), parameters('resourceGroup'), 'Microsoft.EventHub/namespaces/eventhubs', parameters('eventHubNamespace'), parameters('eventHub'))]",
        "consumerGroup": "[parameters('consumergroup')]",
        "tableName": "[parameters('tableName')]",
        "dataFormat": "[parameters('dataFormat')]",
        "blobStorageEventType": "Microsoft.Storage.BlobCreated",
        "mappingRuleName": "[parameters('mappingRuleName')]"
      },
      "tags": {
        "Version": "0.0.0.0",
        "Description": "[parameters('description')]"
      }
    }
  ]
}

参数:

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "0.0.0.0",
  "parameters": {
    "eventHubNamespace": {
      "value": "cpcnx-ehns-adlsv2tokusto-test01"
    },
    "eventHub": {
      "value": "cpcnx-eh-cds-storeingest-adxingest-dbingest-test01"
    },
    "consumergroup": {
      "value": "dpucg"
    },
    "kustoclusterName": {
      "value": "cpcnx-adx-test01"
    },
    "kustoDbName": {
      "value": "ingest"
    },
    "kustoDataConnectionsName": {
      "value": "cdsstoreingestadxingestdbingest"
    },
    "eventHubSubscriptionId": {
      "value": "{subId}"
    },
    "eventHubResourceGroupName": {
      "value": "cpcnx-test-test01"
    },
    "dpuMI": {
      "value": "/subscriptions/{subId}/resourceGroups/{regGroup}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/cpcnx-pipmi-test01"
    },
    "kind": {
      "value": "EventGrid"
    },
    "storageAccountName": {
      "value": "cpcnxsaingesttest01"
    },
    "mappingRuleName": {
      "value": "EHCPCDevices_FastStream_Mapping"
    },
    "tableName": {
      "value": "EHCPCDevices_FastStream"
    },
    "dataFormat": {
      "value": "PARQUET"
    }
  }
}
azure azure-resource-manager azure-data-explorer azure-eventhub azure-eventgrid
1个回答
0
投票

发现验证错误:映射不存在:

检查以下步骤来解决错误“映射不存在”:

  • 确保您在 ARM 模板中使用的特定表中存在映射规则。
  • 检查映射规则是否已在 Kusto 数据库中成功创建并存在于特定 Kusto 集群中。
  • 还要验证集群、数据库和数据表名称是否根据其存在而正确给出,没有任何冲突。

在 Kusto 资源管理器查询编辑器中运行以下查询,以验证映射规则是否确实存在于 Kusto 数据库中。

.show  table  lattable  ingestion  parquet  mappings

enter image description here

  • 如果上述方法无法解决问题,请参考 Kusto 资源管理器中可用的 mapping 格式创建具有所需数据格式的新提取映射规则,并使用修改后的参数名称重新部署模板。

您的代码看起来很符合要求。参考此 MSDoc ARM 模板,我在 Azure 事件网格和数据浏览器之间创建了数据连接。如图所示已成功部署。

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "eventhubnamespace": {
            "type": "string",
            "defaultValue": "cpcnx-ehns-adlsv2tokusto-test0",
            "metadata": {
                "description": "event hub namespace name."
            }
        },
        "eventhubname": {
            "type": "string",
            "defaultValue": "cpcnx-eh-cds-storeingest-adxingest-dbingest-test01",
            "metadata": {
                "description": "event hub name."
            }
        },
        "consumergroup_default_name": {
            "type": "string",
            "defaultValue": "$Default",
            "metadata": {
                "description": "consumer group of the event hub."
            }
        },
        "storageaccount": {
            "type": "string",
            "defaultValue": "caronewperfdiag162",
            "metadata": {
                "description": "storage account name"
            }
        },
        "kustocluster": {
            "type": "string",
            "defaultValue": "cpcnx-adx-test0"
        },
        "kustodb": {
            "type": "string",
            "defaultValue": "ingest",
            "metadata": {
                "description": "database"
            }
        },
        "kustotable": {
            "type": "string",
            "defaultValue": "lattable",
            "metadata": {
                "description": "table"
            }
        },
        "mappingRuleName": {
          "type": "string",
          "defaultValue":"Mapping1"
       },
        "dataformat_type": {
            "type": "string",
            "defaultValue": "PARQUET",
            "metadata": {
                "description": "data format"
            }
        },
             "databaseRouting_type": {
            "type": "string",
            "defaultValue": "Single"
        },
        "dataconnections_kustodc_name": {
            "type": "string",
            "defaultValue": "kustodcnew",
            "metadata": {
                "description": "data connection to create"
            }
        },
        "subscriptionId": {
            "type": "string",
            "defaultValue": "[subscription().subscriptionId]",
            "metadata": {
                "description": "subscriptionId of the resources"
            }
        },
        "resourceGroup": {
            "type": "string",
            "defaultValue": "[resourceGroup().name]",
            "metadata": {
                "description": "resourceGroup of the resources"
            }
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location"
            }
        }
    },
    "variables": {
    },
    "resources": [{
            "type": "Microsoft.Kusto/Clusters/Databases/DataConnections",
            "apiVersion": "2022-02-01",
            "name": "[concat(parameters('kustocluster'), '/', parameters('kustodb'), '/', parameters('dataconnections_kustodc_name'))]",
            "location": "[parameters('location')]",
            "kind": "EventGrid",
            "properties": {
                "managedIdentityResourceId": "[resourceId('Microsoft.Kusto/clusters', parameters('kustocluster'))]",
                "storageAccountResourceId": "[resourceId(parameters('subscriptionId'), parameters('resourceGroup'), 'Microsoft.Storage/storageAccounts', parameters('storageaccount'))]",
                "eventHubResourceId": "[resourceId(parameters('subscriptionId'), parameters('resourceGroup'), 'Microsoft.EventHub/namespaces/eventhubs', parameters('eventhubnamespace'), parameters('eventhubname'))]",
                "consumerGroup": "[parameters('consumergroup_default_name')]",
                "tableName": "[parameters('kustotable')]",
                "dataFormat": "[parameters('dataformat_type')]",
                "mappingRuleName": "[parameters('mappingRuleName')]",
                "databaseRouting": "[parameters('databaseRouting_type')]"
            }
        }
    ]
}

输出

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.