Azure Logic Apps - Get Blob content from Blob Event

情到浓时终转凉″ 提交于 2020-04-16 04:37:17

问题


My logic app receives a blob event when a blob is created via http:

I use an Event Grid Subscription, which triggers the Logic App via webhook, when a Blob Created event occurs.

A typical blob event received by the http trigger looks like:

[
  {
    "topic": "/subscriptions/xxxxxxx/resourceGroups/a-resource-group/providers/Microsoft.Storage/storageAccounts/ablobstorageaccount",
    "subject": "/blobServices/default/containers/testcontainer/blobs/9de2125e-5279-4375-bc60-c9987eb99251",
    "eventType": "Microsoft.Storage.BlobCreated",
    "eventTime": "2018-12-07T12:42:53.6561593Z",
    "id": "3c8f8611-001e-0029-722a-8eb18106aef2",
    "data": {
      "api": "PutBlob",
      "clientRequestId": "799b46aa-ff9f-4561-a087-36f790ab0df5",
      "requestId": "3c8f8611-001e-0029-722a-8eb181000000",
      "eTag": "0x8D65C41819B23B9",
      "contentType": "text/plain",
      "contentLength": 22,
      "blobType": "BlockBlob",
      "url": "https://ablobstorageaccount.blob.core.windows.net/testcontainer/9de2125e-5279-4375-bc60-c9987eb99251",
      "sequencer": "00000000000000000000000000003D5300000000018067c3",
      "storageDiagnostics": {
        "batchId": "be84f175-da20-4a44-8a8c-5d33a92fbcd3"
      }
    },
    "dataVersion": "",
    "metadataVersion": "1"
  }
]

How can I use this event data to specify the blob content, using the Designer's Get blob content action?


回答1:


In addition to @dbarkol answer, the following screen snippet shows using the Get blob content using path where an Expression is:

uriPath(triggerBody()?['data'].url)




回答2:


One way of doing this would be by the path:

  1. Extract the container name from the subject
  2. Extract the file name from the subject
  3. Use the 'Get blob content using path' action. Your blob path will be /{container-name}/{file-name}



回答3:


Generically, you can also set up a Shared Access Signature for your storage account and then access the blob via . This is not Logtic Apps specific but should work for any GET call.

An example of this usage in Logic Apps with Event Grid and Storage is available in this sample.



来源:https://stackoverflow.com/questions/53672902/azure-logic-apps-get-blob-content-from-blob-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!