Azure eventgrid 使用死信存储更新Azure事件网格函数订阅

Azure eventgrid 使用死信存储更新Azure事件网格函数订阅,azure-eventgrid,Azure Eventgrid,我已在名为receivingtestwesteurope的存储帐户上,在资源组omni test下成功创建了一个存储blob创建时的事件触发器,该触发器通过名为ValidateMetadata的函数接收。我是通过门户GUI创建的。但是,我现在想添加死信/重试策略,这只能通过CLI完成 工作触发器如下所示: { "destination": { "endpointBaseUrl": "https://omnireceivingprocesstest.azurewebsites.

我已在名为
receivingtestwesteurope
的存储帐户上,在资源组
omni test
下成功创建了一个存储blob创建时的事件触发器,该触发器通过名为
ValidateMetadata
的函数接收。我是通过门户GUI创建的。但是,我现在想添加死信/重试策略,这只能通过CLI完成

工作触发器如下所示:

{
    "destination": {
      "endpointBaseUrl": "https://omnireceivingprocesstest.azurewebsites.net/admin/extensions/EventGridExtensionConfig",
      "endpointType": "WebHook",
      "endpointUrl": null
    },
    "filter": {
      "includedEventTypes": [
        "Microsoft.Storage.BlobCreated"
      ],
      "isSubjectCaseSensitive": null,
      "subjectBeginsWith": "/blobServices/default/containers/snapshots/blobs/",
      "subjectEndsWith": ".png"
    },
    "id": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/Microsoft.Storage/StorageAccounts/receivingtestwesteurope/providers/Microsoft.EventGrid/eventSubscriptions/png",
    "labels": [
      ""
    ],
    "name": "png",
    "provisioningState": "Succeeded",
    "resourceGroup": "omni-test",
    "topic": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope",
    "type": "Microsoft.EventGrid/eventSubscriptions"
}
首先,我认为可以使用死信队列更新现有事件:

az eventgrid event-subscription update --name png --deadletter-endpoint receivingtestwesteurope/blobServices/default/containers/eventgrid
返回:

az:错误:无法识别的参数:-死信终结点 receivingtestwesteurope/blobServices/default/containers/eventgrid

然后我尝试通过REST补丁:

  • 范围:
    /subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope
  • eventSubscriptionName:
    png
  • api版本:
    2018-05-01-preview
正文:

返回

“模型状态无效。”

===================

最终工作方案:

{
    "deadletterdestination": {
        "endpointType": "StorageBlob",
        "properties": {
            "blobContainerName": "eventgrid",
            "resourceId": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope"
        }
    }
}
看一看,其中详细描述了打开死字。注意,您必须安装eventgrid扩展

az扩展插件add——名称eventgrid

此外,您还可以使用RESTAPI更新事件订阅中的死信

除此之外,我刚刚发布了我的tinny工具,用于在本地机器上帮助使用Azure事件网格模型

更新:

{
    "deadletterdestination": {
        "endpointType": "StorageBlob",
        "properties": {
            "blobContainerName": "eventgrid",
            "resourceId": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope"
        }
    }
}
以下是deadletterdestination属性:

"deadletterdestination": {
  "endpointType": "StorageBlob",
  "properties": {
    "blobContainerName": "{containerName}",
    "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resgroup}/providers/Microsoft.Storage/storageAccounts/{storageAccount}"
   }
 }
您可以将(RESTAPI修补程序)与上述属性一起使用。请注意,必须使用api版本=2018-05-01-preview。

请看一看,其中详细说明了启用死字。注意,您必须安装eventgrid扩展

az扩展插件add——名称eventgrid

此外,您还可以使用RESTAPI更新事件订阅中的死信

除此之外,我刚刚发布了我的tinny工具,用于在本地机器上帮助使用Azure事件网格模型

更新:

{
    "deadletterdestination": {
        "endpointType": "StorageBlob",
        "properties": {
            "blobContainerName": "eventgrid",
            "resourceId": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope"
        }
    }
}
以下是deadletterdestination属性:

"deadletterdestination": {
  "endpointType": "StorageBlob",
  "properties": {
    "blobContainerName": "{containerName}",
    "resourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resgroup}/providers/Microsoft.Storage/storageAccounts/{storageAccount}"
   }
 }

您可以将(RESTAPI修补程序)与上述属性一起使用。请注意,必须使用api version=2018-05-01-preview。

我遇到问题的命令来自您提供的第一个链接我刚刚安装在我的azure portal cloud shell(>\ux)此eventgrid扩展上。回答是:已安装的扩展“eventgrid”正在预览中。因此,您的安装有问题吗?您好,您的更新看起来非常有用。我觉得这很接近,我用我的进步更新了我的问题。我通过在线编辑器运行REST修补程序。修补程序(更新)仅适用于属性,因此json正文的格式必须为:{“deadletterdestination”:{……},“filter”:{},“labels”:[],…},请查看我的更新,我将对其进行编辑。感谢事件订阅REST API(包括
Update
method)url()已失效(404)。有人知道更新的URL是什么吗?我遇到问题的命令来自您提供的第一个链接我刚刚安装在我的azure portal cloud shell(>41;此eventgrid扩展上。回答是:已安装的扩展“eventgrid”正在预览中。因此,您的安装有问题吗?您好,您的更新看起来非常有用。我觉得这很接近,我用我的进步更新了我的问题。我通过在线编辑器运行REST修补程序。修补程序(更新)仅适用于属性,因此json正文的格式必须为:{“deadletterdestination”:{……},“filter”:{},“labels”:[],…},请查看我的更新,我将对其进行编辑。感谢事件订阅REST API(包括
Update
method)url()已失效(404)。有人知道更新后的URL是什么吗?太好了。对于死信,有一个坏消息,例如关闭死信。我曾多次向MS Event Grid团队提及,响应如下:您不能使用修补程序,您必须使用多个请求,例如GET subscription、GET full destinationEndpointUrl,然后使用PUT请求在没有deadLetterDestination属性的情况下重新创建此事件订阅。我认为,这是一个错误。换句话说,我们不能使用简单的删除属性,比如“deadletterdestination”:null,这太好了。对于死信,有一个坏消息,例如关闭死信。我曾多次向MS Event Grid团队提及,响应如下:您不能使用修补程序,您必须使用多个请求,例如GET subscription、GET full destinationEndpointUrl,然后使用PUT请求在没有deadLetterDestination属性的情况下重新创建此事件订阅。我认为,这是一个错误。换句话说,我们不能使用简单的删除属性,例如“deadletterdestination”:null