gpt4 book ai didi

azure - 通过 ARM 模板对 EndpointType 为 AzureFunction 的主题进行事件订阅

转载 作者:行者123 更新时间:2023-12-02 05:58:21 25 4
gpt4 key购买 nike

我正在尝试使用 "endpointType": "AzureFunction" 创建事件网格主题订阅。它给出以下错误:-

"error": { "code": "InvalidRequest", "message": "Invalid event subscription request: Supplied URL is invalid. It cannot be null or empty and should be a proper HTTPS URL like https://www.example.com." }

我的 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')]"
]
}

之前,我使用 EndpointType 作为 Webhook,因为 Azure Function、存储队列等新事件处理程序不可用 ( https://learn.microsoft.com/en-us/azure/event-grid/event-handlers )。我使用了从 Azure 门户生成的 Arm 模板,如下所示:-

enter image description here

有人遇到过这个问题吗?

最佳答案

是的!当我遇到同样的问题时发现了这个! ..

更新!找到了一个使用另一个API版本的示例,它似乎工作得更好,现在我的问题是第一次部署时没有代码,所以我需要将模板分成两部分并在中间部署内容(或通过模板ofc)。

"apiVersion": "2020-01-01-预览",

https://blog.brooksjc.com/2019/07/19/arm-template-for-event-grid-integration-with-a-new-azure-function/

更新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"
}
}

关于azure - 通过 ARM 模板对 EndpointType 为 AzureFunction 的主题进行事件订阅,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60207556/

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