Table of Contents
- Azure Function
- Features of Azure Function
- How to Create Azure Function App
- Creation of New Function
- Video Tutorial
Azure Function is a solution for easily running code or function through the cloud without having to worry about the whole application or the infrastructure to run it. Azure Function has the ability to make the development even more productive and the user will be able to choose a development language of their choice. If the user is a Java developer, then they may use Java as the programming language and similarly for PowerShell or Python.
Features of azure function
- The very first feature is the option to choose one’s desired language.
- The other main feature is the fact that the money spent on using it will be based on the time spent running it.
- The Azure Function can be integrated in order to protect the HTTP trigger function with various providers such as Azure Active Directory, Facebook, Google, Microsoft, and Twitter, etc.
- Since it is open-source, the user will be able to see the function run time open-source which is available on GitHub.
How to create azure function app
The first step is to log into the Azure portal using the user’s credentials. On top of the page, there will be an icon named ‘Create Resource’ which is to be clicked. On the search box that comes up, the user will be required to search for the function app. There will be two versions available called Function App and Function App (Classic) where the classic app is the older version of the two.
On choosing the Function App, it will display the overview containing information about the Documentation, Solution Overview, and Pricing Details along with the Plans. To create a brand new function app, the button called ‘Create’ which will be located on the top of the screen must be selected.
The following will be the various subsections of information that is required to be filled in by the user –
Project Details – It consists of the Subscription type and the Resource Group which can either be created anew or the user can use an existing one.
Instance Details – Name of the Function App, Publish (Code / Docker Container), Run-Time Stack, and the Region.
The other subsections are Hosting, Monitoring and Tags.
Storage Account – New / Existing
Operating System – Linux / Windows
Plan – The plan type can be chosen which dictates how the apps scales, what features are enabled and how it is priced. The options are Consumption, Premium and App Service Plan.
Application Insights – Enable / Disable
Application Insights – New / Existing
The final step is Review & Create. Once the review has been performed and all the errors are corrected, the ‘Create’ button will be enabled, allowing the user to click it to create the function app. The deployment will then be successfully completed and running.
Going back to the Home Tab and going to the ‘Resource Group’ service on the list of Azure services offered, the function can be selected to see the resources that had been created for it. It will display the created Function App, the Application Insights if they had been enabled by the user, the Storage Account, and the App Service Plan. Everything would have been created into the location given by the user and everything would be logically grouped into the resource group.
Opening the Function App, the overview of the same can be viewed with all the details. An additional tab called the ‘Platform Features’ will be located alongside with contains all the features that are available.
Creation Of New Function
On the overview page, there is an option called ‘New Function’ that is located at the bottom of the screen. The user must click on this button.
For the new function, there are different ways that are available to create it. The Development Environment is of three different types as follows –
- Visual Studio
- VS Code – Open source from Microsoft
- Any Editor + Core Tools
- In Portal
Once the option has been selected, click on the button called ‘Continue’ located at the bottom of the page. The next step is called ‘Create a Function’ which can be done through different templates such as
- Webhook + API – A function that will be run whenever it receives an HTTP request.
- Timer – A function that will be run on a specified schedule.
There are more templates that are available to be used for this purpose on the Azure platform such as HTTP Trigger, Timer Trigger, Azure Queue Storage Trigger and Azure Service Bus Queue Trigger etc.
Functions are great solutions for processing data, integrating systems, working with an Internet of Things and building sample APAs and micro service.
Once the desired template has been chosen, the new function can be created. If the HTTP Trigger template is chosen, the requirements to be filled in by the user are the name to be allotted and the Authorization Level (Function, Anonymous or Admin). This function will run whenever it receives an HTTP request or response based on the data in the body or in the storage. The function app can then be run in order to check whether everything is looking good and working well.
The files that are being used in the function app can also be viewed on the right-hand corner of the screen. New files can be added and unwanted files can also be deleted. There is also an URL to get the function.
This function acts as an APA for the user and can be run to retrieve sample values.