How to delete a blob from a blob storage container in an azure function RRS feed

  • Question

  • I've seen an example of creating a blob in a storage account from an Azure Function, using nodejs. (Forum won't let me use link)

    I want to do something similar, I want to delete a blob from a storage account.

    I've set up the following as an output binding:


    I have two problems:

    1) In my function, I figure out the value I want for `name`. How to I specify that?
    2) I could write to this container by setting `context.bindings.outputContainer = blob` but I'm at a loss as to how I can use this binding to delete. Is this possible?

    Wednesday, May 20, 2020 9:20 PM

All replies

  • Hi Eric - Regarding #1, the blob name is a type of information that can come from the trigger binding -- in other words, your trigger is usually what supplies this type of information to your Function app. For example, you can configure an HttpTrigger function app where the blob name comes from the body of the request (in a JSON data structure) and the main code of your function code would be to carry out the delete operation. Upon successful or failure of the operation, you can then pass this result in the response via output binding of your function.

    As for #2, delete operation isn't possible with the output binding. Instead, you can use the deleteBlob operation from the azure-storage npm package in the body of your Function code to do this. Hope this helps, let me know if you had any further questions.
    Monday, June 1, 2020 6:01 AM