In this Azure article, we will discuss, the easiest approach to create a Function App in Azure using Azure Portal.
Table of Contents
How to create a Function App in Azure Portal
Before going to discuss the steps, as prerequisites, we need the following things
- You should have a valid Azure Subscription or an Azure Account. If you don’t have an Azure Account till now, create an Azure Free Account now.
- You should have an Azure Storage Account. If you don’t have a storage account till now, Create a storage account now.
Follow the below steps to create Azure functions in the Azure portal.
Step-1: Login to Azure Portal (https://portal.azure.com/)
Step 2: Click on the + Create a resource and from the New Window, click on “Compute”. Now, choose “Function App”.
Step-3: On the Create Function App window, on the Basics tag, provide the below details.
- Subscription: Choose your Correct Subscription.
- Resource Group: Choose your Existing Resource Group and if you don’t have any existing resource group, you can create a new one by clicking the Create new link.
- Function App name: Enter a valid Function App name.
- Publish: Choose the Code option.
- Runtime stack: Choose the .NET Core Option.
- Version: You can choose the 3.1
- Region: Select the Region for the Function App.
Click on the Next: Hosting > button now.
On the Hosting tab, Select the storage account or create a new storage account by clicking on the Create new link.
Keep the default option for all other tabs as it is. Next, click on the Review + Create button, Now it will validate all the fields and it will show the Create button. Now click on the Create button to create the Function App.
Now, you can see the deployment is completed successfully.
Now you can see the new Azure function app is created Successfully.
So we have created our Azure Function App, Now we need to create the Functions. So click on the Functions link from the left navigation and click on the + Add button to create the Functions.
The next is to select the HTTP trigger on the New Function window.
On the New Function Window, you can keep the default name as it is or you can provide a new name and then Choose the Authorization level as Function. Finally, click on the Create Function to create the function.
Now, you can see the Function created successfully.
Now you can see the function created successfully, click on the Code + Test link from the left navigation, Now you can able to see the inbuilt code in the right-side editor. You can modify the code as per your requirement and then click on the save button, it will save the changes.
Test Azure Function In Portal
Now you can test the function if it is working as expected. Click on the Test/Run button to test the function.
Then on the Input window, select the POST method, you can change the name parameter value in the Body and then click on the Run button.
Now you can see, that we got the output and the HTTP response code as expected.
Now I have just changed the name parameter value from Azure to Raj and then clicked on the run button.
Now you can see the expected output and response code below.
Now what we will do is we will test this function App in the Postman app. So click on the Get function URL button from the top.
On the Get function URL popup, click on the Copy button to copy the function URL
The URL will be like below
Now open the Postman app and paste the URL choose the POST operation provide the JSON parameter value in the body and then click on the Send button. Now you can able to see the expected output with the proper response code.
Now, I have modified a little bit in the code in the function in the Azure Portal as below and clicked on the Save button to save the changes.
Now, to check if it is working as expected, Run the Postman app again. Now you can see below we got the expected response based on our update in Azure Function.
You can also Create Azure Functions In Visual Studio.
In this Azure article, we discussed how to create a Function App in Azure Portal. Thanks for reading this article !!!
I am Rajkishore, and I have over 14 years of experience in Microsoft Azure and AWS, with good experience in Azure Functions, Storage, Virtual Machine, Logic Apps, PowerShell Commands, CLI Commands, Machine Learning, AI, Azure Cognitive Services, DevOps, etc. Not only that, I do have good real-time experience in designing and developing cloud-native data integrations on Azure or AWS, etc. I hope you will learn from these practical Azure tutorials. Read more.