0
votes

I'm creating a new function app for a blob event trigger by using the command func new --template BlobTrigger. The generated Python entrypoint for the BlobTrigger looks as follows:

def main(myblob: func.InputStream):
    logging.info(f"Python blob trigger function processed blob \n"
                 f"Name: {myblob.name}\n"
                 f"Blob Size: {myblob.length} bytes")

The myblob contains the image blob data that was uploaded to the blob storage. I'd need the corresponding metadata to this blob as well. I haven't found any way to get the metadata from the myblob parameter, looking at the available functions and attributes, it doesn't have any to retrieve the metadata from it.

Is there a way to get the metadata from this object or would I have to do a separate call to the Blob storage to retrieve that info?

1
I know it is not really related but you should use eventgrid rather than blob trigger: docs.microsoft.com/en-us/azure/storage/blobs/… - Thomas
I can't see anywhere that the event grid sends the actual blob or the metadata? - wasp256

1 Answers

0
votes

I suggest you getting an idea of event-based triggers in Azure Data Factory to implement your requirements. You could configure the blob account:

enter image description here

When an event trigger fires for a specific blob, you could captures the folder path and file name of the blob into the properties @triggerBody().folderPath and @triggerBody().fileName.