gpt4 book ai didi

azure - 流分析作业部署为 Azure 资源管理器 (ARM) 模板

转载 作者:行者123 更新时间:2023-12-03 01:04:53 24 4
gpt4 key购买 nike

我正在尝试为定义为 JSON 模板的流分析作业设置一个输出 EventHub。如果没有输出位,模板将成功部署,但是在添加输出定义时会失败,并显示:

Deployment failed. Correlation ID: <SOME_UUID>. {
"code": "BadRequest",
"message": "The JSON provided in the request body is invalid. Property 'eventHubName' value 'parameters('eh_name')' is not acceptable.",
"details": {
"code": "400",
"message": "The JSON provided in the request body is invalid. Property 'eventHubName' value 'parameters('eh_name')' is not acceptable.",
"correlationId": "<SOME_UUID>",
"requestId": "<SOME_UUID>"
}
}

我将 ARM 模板定义为:

{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "westeurope"
},
"hubName": {
"type": "string",
"defaultValue": "fooIotHub"
},
"eh_name": {
"defaultValue": "fooEhName",
"type": "String"
},
"eh_namespace": {
"defaultValue": "fooEhNamespace",
"type": "String"
},
"streamAnalyticsJobName": {
"type": "string",
"defaultValue": "fooStreamAnalyticsJobName"
}
},
"resources": [{
"type": "Microsoft.StreamAnalytics/StreamingJobs",
"apiVersion": "2016-03-01",
"name": "[parameters('streamAnalyticsJobName')]",
"location": "[resourceGroup().location]",
"properties": {
"sku": {
"name": "standard"
},
"outputErrorPolicy": "Drop",
"eventsOutOfOrderPolicy": "adjust",
"eventsOutOfOrderMaxDelayInSeconds": 0,
"eventsLateArrivalMaxDelayInSeconds": 86400,
"inputs": [{
"Name": "IoTHubInputLable",
"Properties": {
"DataSource": {
"Properties": {
"iotHubNamespace": "[parameters('hubName')]",
"sharedAccessPolicyKey": "[listkeys(resourceId('Microsoft.Devices/IotHubs/IotHubKeys',parameters('hubName'), 'iothubowner'),'2016-02-03').primaryKey]",
"sharedAccessPolicyName": "iothubowner",
"endpoint": "messages/events"
},
"Type": "Microsoft.Devices/IotHubs"
},
"Serialization": {
"Properties": {
"Encoding": "UTF8"
},
"Type": "Json"
},
"Type": "Stream"
}
}],
"transformation": {
"name": "Transformation",
"properties": {
"streamingUnits": 1,
"query": "<THE SQL-LIKE CODE FOR THE JOB QUERY>"
}
},
"outputs": [{
"name": "EventHubOutputLable",
"properties": {
"dataSource": {
"type": "Microsoft.ServiceBus/EventHub",
"properties": {
"eventHubName": "parameters('eh_name')",
"serviceBusNamespace": "parameters('eh_namespace')",
"sharedAccessPolicyName": "RootManageSharedAccessKey"
}
},
"serialization": {
"Properties": {
"Encoding": "UTF8"
}
}
}
}]
}
}]
}

在这里检查https://learn.microsoft.com/en-us/azure/templates/microsoft.streamanalytics/streamingjobs看起来输出的 JSON 结构与预期一致(具有 properties 字段以及 type)。

我已经使用开发人员工具从 Chrome 浏览器中找出了这些“事件中心属性”,并检查了 HTTP 请求“GetOutputs”的详细信息,否则我不确定在哪里可以看到如何指定这些属性?该结构看起来与输入 IoT 中心(正在运行)的结构非常相似,在这种情况下,对与 IoT 中心详细信息相关的属性使用不同的标签。

查看这篇博文https://blogs.msdn.microsoft.com/david/2017/07/20/building-azure-stream-analytics-resources-via-arm-templates-part-2-the-template/输出部分与 PowerBI 相关,并且看起来属性使用了不同的结构:outputPowerBISource,因此我尝试将字段 outputEventHubSource 用于事件中心(来自使用 Chrome 开发者工具的检查)而不是 properties,但随后我收到此错误:

Deployment failed. Correlation ID: <SOME_UUID>. {
"code": "BadRequest",
"message": "The JSON provided in the request body is invalid. Required property 'properties' not found in JSON. Path '', line 1, position 1419.",
"details": {
"code": "400",
"message": "The JSON provided in the request body is invalid. Required property 'properties' not found in JSON. Path '', line 1, position 1419.",
"correlationId": "<SOME_UUID>",
"requestId": "<SOME_UUID>"
}
}

我用来部署此模板的命令是 Azure CLI(来自 Linux Debian 计算机):

az group deployment create \
--name "deployStreamAnalyticsJobs" \
--resource-group "MyRGName" \
--template-file ./templates/stream-analytics-jobs.json

如何在 Azure 资源管理器 (ARM) 模板中为流分析作业指定输出

最佳答案

任何包含参数的属性(或任何需要计算的表达式都必须包含方括号,例如

"eventHubName": "[parameters('eh_name')]",
"serviceBusNamespace": "[parameters('eh_namespace')]",

否则使用引号中的文字值。

有帮助吗?

关于azure - 流分析作业部署为 Azure 资源管理器 (ARM) 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51842809/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com