EndpointType为AzureFunction的主题的ARM模板事件订阅
我正在尝试使用“endpointType”:“AzureFunction”创建事件网格主题订阅。它给出了以下错误:- “错误”:{ “代码”:“InvalidRequest”, “消息”:“无效的事件订阅请求:提供的URL无效。它不能为null或空,并且应该是正确的HTTPS URL。” 比如说 我的手臂模板如下所示:-EndpointType为AzureFunction的主题的ARM模板事件订阅,azure,azure-functions,azure-resource-manager,arm-template,azure-eventgrid,Azure,Azure Functions,Azure Resource Manager,Arm Template,Azure Eventgrid,我正在尝试使用“endpointType”:“AzureFunction”创建事件网格主题订阅。它给出了以下错误:- “错误”:{ “代码”:“InvalidRequest”, “消息”:“无效的事件订阅请求:提供的URL无效。它不能为null或空,并且应该是正确的HTTPS URL。” 比如说 我的手臂模板如下所示:- { "name": "[concat(variables('eventGridTopicName'), '/Microsoft.EventGrid/', varia
{
"name": "[concat(variables('eventGridTopicName'), '/Microsoft.EventGrid/', variables('myFuncName'))]",
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2019-01-01",
"location": "[parameters('location')]",
"properties": {
"topic": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.EventGrid/topics/', variables('eventGridTopicName'))]",
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "[resourceId('Microsoft.Web/sites/functions/', variables('funcAppName'), variables('myFuncName'))]",
"maxEventsPerBatch": 1,
"preferredBatchSizeInKilobytes": 64
}
},
"filter": {
"advancedFilters": [
{
"operatorType": "StringIn",
"key": "eventType",
"values": [
"xyzEvent"
]
},
{
"operatorType": "StringIn",
"key": "subject",
"values": [
"xyzEventReceived"
]
}
]
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
},
"dependsOn": [
"[variables('eventGridTopicName')]"
]
}
早些时候,我使用EndpointType作为webhook,因为Azure函数、存储队列等新事件处理程序不可用()。我使用了从Azure portal生成的arm模板,如下所示:-
{
"name": "[concat(variables('eventGridTopicName'), '/Microsoft.EventGrid/', variables('myFuncName'))]",
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2019-01-01",
"location": "[parameters('location')]",
"properties": {
"topic": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.EventGrid/topics/', variables('eventGridTopicName'))]",
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "[resourceId('Microsoft.Web/sites/functions/', variables('funcAppName'), variables('myFuncName'))]",
"maxEventsPerBatch": 1,
"preferredBatchSizeInKilobytes": 64
}
},
"filter": {
"advancedFilters": [
{
"operatorType": "StringIn",
"key": "eventType",
"values": [
"xyzEvent"
]
},
{
"operatorType": "StringIn",
"key": "subject",
"values": [
"xyzEventReceived"
]
}
]
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
},
"dependsOn": [
"[variables('eventGridTopicName')]"
]
}
有人面对过这个问题吗 是的!当我有同样的问题时发现了这个 更新!找到了一个使用另一个API版本的示例,它似乎可以在两个版本之间工作,现在我的问题是,在第一次部署时没有代码,所以我需要将模板一分为二,并在btween中部署内容(或通过模板ofc部署内容) “apiVersion”:“2020-01-01-preview” 更新2,添加内容并重新运行模板后,工作正常 这是我的存储触发器的完整代码
{
"name": "[concat(variables('storageAccountName'), '/Microsoft.EventGrid/coreCostManagementExport')]",
"type": "Microsoft.Storage/storageAccounts/providers/eventSubscriptions",
"apiVersion": "2020-01-01-preview",
"dependsOn": [
"[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]",
"[resourceId('Microsoft.Web/sites',parameters('functionAppName'))]"
],
"properties": {
"topic": "[resourceId('Microsoft.Storage/storageAccounts',variables('storageAccountName'))]",
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "[resourceId('Microsoft.Web/sites/functions/', parameters('functionAppName'), 'QueueUsageOnExport')]",
"maxEventsPerBatch": 1,
"preferredBatchSizeInKilobytes": 64
}
},
"filter": {
"subjectBeginsWith": "/blobServices/default/containers/usage",
"subjectEndsWith": ".csv",
"includedEventTypes": [
"Microsoft.Storage.BlobCreated"
],
"advancedFilters": [
]
},
"labels": [
],
"eventDeliverySchema": "EventGridSchema"
}
}
Jakob关于更改api版本的建议在resourceId中的更改对我起到了作用。这是我修改过的工作模板:-
{
"name": "[concat(variables('eventGridTopicName'), '/Microsoft.EventGrid/', variables('myFuncName'))]",
"type": "Microsoft.EventGrid/topics/providers/eventSubscriptions",
"apiVersion": "2020-01-01-preview",
"location": "[parameters('location')]",
"properties": {
"topic": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.EventGrid/topics/', variables('eventGridTopicName'))]",
"destination": {
"endpointType": "AzureFunction",
"properties": {
"resourceId": "[concat('/subscriptions/', parameters('subscriptionId'),'/resourcegroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/sites/', variables('funcAppName'), '/functions/' , variables('myFuncName'))]",
"maxEventsPerBatch": 1,
"preferredBatchSizeInKilobytes": 64
}
},
"filter": {
"advancedFilters": [
{
"operatorType": "StringIn",
"key": "eventType",
"values": [
"xyzEvent"
]
},
{
"operatorType": "StringIn",
"key": "subject",
"values": [
"xyzEventReceived"
]
}
]
},
"labels": [],
"eventDeliverySchema": "EventGridSchema"
},
"dependsOn": [
"[variables('eventGridTopicName')]"
]
}
在我的场景中,我试图使用“AzureFunctionEventSubscriptionDestination”作为目标向事件网格主题添加函数应用程序订阅。我的问题是我没有将/functions/{targetFunctionName}添加到资源id中
“resourceId”:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{functionppname}/functions/{targetFunctionName}”这由“For WebHook,表示事件订阅目标端点的URL”确认。很抱歉,我在找到新答复时删除了旧答复,我还没看到你的回答!。。但是webhook应该可以工作,但是更新的版本更好更简单!:)必须是一个bug,它在当前api中不起作用,只有新的预览api。将我的工作代码添加到原始答复中