Introduction
This article will help you learn how to create Azure Function – Blob Trigger in Visual Studio.
Before reading this article, please go through some important articles mentioned below,
- Exploring About Azure Function
- Create Http Trigger Azure Function In Azure Portal
- Create The Timer Trigger Azure Function In Azure Portal
- Create Durable Function In Azure Portal
- Create Durable Function In Visual Studio
- Create Azure Function In Visual Studio
- Create Azure Function - Blob Trigger In Azure Portal
- Create Azure Function - Queue Trigger In Azure Portal
- Create Azure Function - Timmer Trigger In Visual Studio
Azure Function
Azure Functions is a serverless computing service and is hosted on the Microsoft Azure public cloud. It is designed to accelerate and simplify application development. The cloud provider takes care of all the headaches of running the server, dynamically managing the resources of the machine, etc. It also provides auto scalability.
Serverless applications, also known as Function-as-a-Service or FaaS, is an offering from most of the enterprise cloud providers in which they allow the users to only write code, and the infrastructure behind the scenes is managed by them.
Azure Functions is the event-based serverless application framework which can automatically scale up and down based on the executions that are being triggered. This Microsoft Azure service allows you to run small pieces of code in Node.js, C#, Python, PHP and Java without any infrastructure configurations.
Here, we will see about Azure Function.
Purpose
Azure Functions lets you execute your code in a serverless environment without having to first create a VM or publish a web application.
Key Features
- Intuitive, browser-based user interface - You can write code in the easy-to-use web interface.
- write code in different programming languages
- pay per function execution
- parallel execution when multiple triggers occur
- Supports Continuous Deployment and Integration
Create Azure Function - Blob Trigger in Visual Studio
Prerequisites
Follow the below steps to create an Azure Storage Account.
Step 1
Log in here. we have to create a Storage account.
![Blob Trigger in Visual Studio]()
![]()
Enter the values and click on create
![Blob Trigger in Visual Studio]()
![]()
Once it is created, the windows like this
![Blob Trigger in Visual Studio]()
Step 2
Open Visual Studio and choose to Create a new Project.
![Blob Trigger in Visual Studio]()
Step 3
Now, choose Azure Functions here.
![Blob Trigger in Visual Studio]()
![]()
Step 4
Next, enter your Project name. Then click on the Next button.
![Blob Trigger in Visual Studio]()
![]()
Step 5
In the next window, Choose triggers as Blob Trigger Function.
![Blob Trigger in Visual Studio]()
Step 6
Once it is created, we can see coding. It’s similar to function coding created in the portal. This is Blob Trigger Function coding.
![Blob Trigger in Visual Studio]()
Step 7
Then, add the connection string from the storage account to local.setting.json
![Blob Trigger in Visual Studio]()
Step 8
Now, we need to create containers and blob in the storage account for getting the log details in functions. So, move to the storage account.
![Blob Trigger in Visual Studio]()
Then, click on the container and enter the name & access level.
![Blob Trigger in Visual Studio]()
Its looks like this window.
![Blob Trigger in Visual Studio]()
![]()
Output
Run the code.
![Blob Trigger in Visual Studio]()
![]()
Now, Open the storage account and click on upload to upload the file in container
Add the “workitem.txt” file into the container
![Blob Trigger in Visual Studio]()
![]()
Now, its added to the container
![Blob Trigger in Visual Studio]()
![]()
Now, open the visual studio. we can successfully run our blob trigger function here. The output will look like this.
![Blob Trigger in Visual Studio]()
![]()
Summary
I hope you understood how we can create a Blob trigger function in Visual Studio. Stay tuned for more articles on Azure Function.