What is Azure Function App?
Azure Function App is available as part of Azure Compute Services. As the name says they are nothing but small piece of code running on cloud. These are serverless, so no worry about the application or infrastructure (like a server, IIS , certificates etc.,).
Create Function App
Login to azure portal https://portal.azure.com with your credentials
In the Create Function App panel, you need to fill up the below details:
- Type your preferred “App Name”, Azure will check the availability of that name for you and gives the indication a tick mark or a cross symbol
- ‘Subscription’ auto selected as per your registered subscription type. Till yesterday it was ‘Free Trial’ for me and now it’s ‘Pay-As-You-Go’ as my 1-month free subscription expired so I have upgraded to ‘Pay as you go’.
- Before you upgrade, please refer Microsoft pricing here. Azure gives initial free transactions which we don’t need to pay, I believe I will use within that 😊
- Create a Resource Group if you don’t have one. This is just a logical grouping for keeping your resources at one categorized place
- Hosting Plan I have selected ‘Consumption Plan’
- Location as ‘UK South’. You can select your nearest Data centre
- Runtime Stack as ‘.Net Core’ and go with default storage. Click Create.
Note: Please wait for a while until the Azure completes creating the Function App for you. You can see that on top right notification area
It’s done now. Click ‘Go to resource’
Hence my function app is created and here the dashboard of it
Copy the URL value as we need it later point for accessing
Create a Function
- Click the function (+) symbol to create a function under function apps, which will give the below
- We can create a function from Visual Studio, VS code, Azure command line function tool or via portal. Here in this sample we will create through the portal itself
- Then continue with selecting Webhook + API (This gives the HTTP trigger) and click continue
- Finally your function is created and the default piece of code is available in the Azure online editor as we have selected ‘In-portal’ in the previous step. We will see the next blog using VS Code
- Leave the code as is
- In the Test window enter Query field as ‘name’ and value field as ‘veera’ and click ‘Run’. Under the output panel you could see ‘Hello, veera’.
- You can also test this in browser as well. Click ‘Get function URL’ to copy the function url and add ‘&name=veera’ (https://sampleazurefunctionapp.azurewebsites.net/api/HttpTrigger1?code=LI8N8Dw7vMyc2UPTFGX8G8VXDwFUEz3N9Vv9DOE8a6NnVAzkexA50w==&name=veera)
We made it, now your preferred code logic is available on cloud and can be accessed from anywhere. It can be consumed from both on premise and a cloud resource. The function app can be accessed through HTTP POST and GET method.
Amazing Azure function apps created in less time and with less azure skills.
In the next blog we can see how SharePoint framework webpart connects with Azure function app.
Thanks for reading my article.