代码之家  ›  专栏  ›  技术社区  ›  Red Riding Hood

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

  •  0
  • Red Riding Hood  · 技术社区  · 6 年前

    我已成功地在存储blob创建时,在名为的存储帐户上创建了事件触发器 receivingtestwesteurope ,在资源组下 omni-test ,通过调用的函数接收 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/BlobsServices/Default/Containers/EventGrid

    然后我尝试通过休息补丁:

    https://docs.microsoft.com/en-us/rest/api/eventgrid/eventsubscriptions/update

    • 经营范围: /subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope
    • 事件订阅名称: 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"
      }}
    

    谁会回来?

    “模型状态无效。”

    (=)

    最终工作方案:

    {
        "deadletterdestination": {
            "endpointType": "StorageBlob",
            "properties": {
                "blobContainerName": "eventgrid",
                "resourceId": "/subscriptions/fa6409ab-1234-1234-1234-85dd2b3ceab4/resourceGroups/omni-test/providers/microsoft.storage/storageaccounts/receivingtestwesteurope"
            }
        }
    }
    
    1 回复  |  直到 6 年前
        1
  •  1
  •   Roman Kiss    6 年前

    Manage Event Grid delivery settings

    Azure Event Grid Tester

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

    Event Subscriptions - Update

    推荐文章