Create and deploy your first Azure Function using Visual Studio - CloudFronts

Create and deploy your first Azure Function using Visual Studio

In my previous blog, we created and deployed an Azure function using the Azure Portal itself.

Now In this part of the blog, we will see how we can create and deploy Azure Function using Visual Studio.

To proceed you would need ASP.NET and Azure Development extensions installed on top of your Visual Studio. If you haven’t had these installed you can go to Apps and features on your device and modify the installed program by selecting the change option instead of Uninstall.

After installing these extensions, Create a new Project and search for Azure functions.

Give the Project any desired name.

Set the trigger for the function as HTTP.

A sample piece of code will get loaded.

In this scenario, I will modify the default code and write my custom logic, which adds two numbers.

To run this logic, press F5 button on your keyboard and copy the URL, hitting this URL will trigger our function.

Paste and run this URL in a web browser.

As you can see on hitting the URL the function gets triggered and our two numbers get added in the output. Now we have to publish our function, it’s been working amazingly.

Right-click on the Project Name and click on the Publish button.

Select the target as Azure.

Select Specific Target as Azure Function.

Select the desired Function app instance or create a new one.

Click on the final publish button.

Wait for the function to successfully get deployed.

Now we will check this in the Azure Portal and trigger it from there, Log in to the Azure account.

You will find the recently deployed function in the left pane in the Functions section.

Open this function and get its URL.

Paste and run this URL in a web browser.

You can see the output.

Hope you understood the process of deploying serverless Azure functions using Visual Studio.

Have a great day!


Share Story :

Secured By miniOrange