Showing posts with label Cloud. Show all posts
Showing posts with label Cloud. Show all posts

Tuesday, July 14, 2020

"Hello World" : Azure Functions Tutorial

Creating a new service in cloud comes with all sorts of boiler plate tasks, managing a VM, managing deployments, keeping the software's updated etc. Azure Functions, enables a developer to just focus on small functionality pieces and underlying infrastructures takes care of all the boilerplate.

See the source image

Azure Functions support a variety of trigger points, ranging from HTTP, Webhooks, Event grids, IOT and many more. For a complete list look up here.

Azure functions, just like conventional Serverless computing stack, brings in financial savings. You pay per the resources you use, instead of paying for reserved resources upfront.

Azure functions, triggered via HTTP developing and managing REST apis super simple, removing most of the boiler plate out of the way.

See the source image



Visual Studio supports out of box and provides for a great interface for running and testing these functions locally as well as publishing directly to Azure cloud.
It does support few languages, obviously C# and in addition F#, Javascript etc.

Lets get started with our hello world example

1. Create a new project in Visual studio and Choose Azure Functions as template


2. Choose Http Trigger as type of Azure Function application



3. To run the project locally, just run the project, should launch the console and lets you know the endpoint on localhost, to be used for firing the apis



4. To test the application, use POSTMAN application to fire the api published on console, example  :http://localhost:7071/api/Function1




Publishing the project on Microsoft Azure if straightforward from here

1. Right click on project from Solution Explorer
2. Choose Publish



3. One you choose the right subscription setting, application would get published as a Azure Function.

4. Just like local setup, you can test it from Postman via an api like : http://mysite.azurewebsites.net/api/SampleFunction


Merging and Splitting PDF files

We all use and rely on PDF's. There are occasions though when you want to edit certain portions of a pdf and merge the edited version ba...