DEV Community

Zain Ahmed
Zain Ahmed

Posted on

How to trigger blob function on Azure Storage in Node.js

I was working on a scenario in which I need to create a node.js application having a Azure Function App function which will trigger when ever a particular container of a particular storage app get file/s or any change in uploaded files.

Let create all these from scratch

Extensions

  1. first you need to install some Azure extensions

20

These extensions will help you later in application

Create Storage & Function app

  1. now got to the Azure icon on left sidebar and create a function using plus icon

1

  1. Select language

2

  1. Select Azure Blob Storage Trigger

3

  1. Set name for function

4

  1. Select storage from where you will upload file. if you hasn't create a storage let create first.

5

  1. Creating Storage on Azure dashboard

6

  1. Set name for storage and you will get this output

7

  1. We need to create function app also in Azure dashboard so let create it that one first

8

9

10

  1. Now let continue with creating function, after creating function in VS code you will get this file structure

11

  1. Now lets upload the function to our Azure dashboard Function App. 12.Right click on the local function folder and click on deploy to function app

12

13

  1. You can check/verify that the local workplace function is up on Azure dashboard

14

  1. In local.setting.json file you will find object having some key values, to add the value of key **AzureWebJobStorage **you need the connection string. 15
  2. Go to storage app account you created earlier and go to access key option in left menu. Copy connection string and past in local.setting.json file object

16
Their will be a file name function.json in folder which you created for function app that file will have config about from which container the function will connect and trigger whenever the file upload/update.

17

  1. Let create a container in our storage app while creating a container name will be same as we define in function app funcion.json file path key

18

lastly open the VS code terminal and run the command func host start. After start the server go to the container in Azure dashboard and try to upload a file in it. After upload successful you will get the output on function terminal which you can check on VS code terminal

19

Follow for more https://linktr.ee/zaahmed

Top comments (0)