Azure Functions #2: Creating a Function App in the Azure Portal
In the first article of this series, we had an introduction in to Azure Functions and what features it brings for developers. We talked about all the fundamentals we need to start working with Azure Functions. In this article, we will look in to how to create a Function Application in the Azure Portal and look at the features provided by the Function Apps to get our-self familiar with the user interface of Functions Applications.
Let’s start by creating a Function App from the Portal. Login to the Azure Portal at https://portal.azure.com and from the side menu click on Green Plus button (1) to create a new resource. Then search for “Function” in the search box (2) and the first result should be the Function App (3).
Click on the Function App link on the search results and a new blade will appear with a button to create the function app. Click on the Create button (4) to create the function application.
A new blade will pop up where you need to add the details related to your Function App (1). You need to add a Unique App Name which will become the URL for the Function App. Then select the Subscription and Create or Select an existing Resource Group your Function App deploys to. Next is one of the important selections. You need to select the Hosting Plan. There are 2 options, Consumption Plan or App Service Plan. As we discussed in the Introductory article, Consumption Plan is a Pay-As-You-Go plan and the App Service Plan uses an existing App Service Plan or a newly created App Service Plan. If you select the App Service Plan as the hosting plan you will be given the option to select or create an App Service Plan. (We will select the Consumption Plan for this example.)
Next you need to select the Location for the Function App and then Create or Select an Existing Storage Account. You can add a name If you choose to create a new Storage Account. This storage account will be used store the logs and matrices collected from the Function App and also can be used to create Queues and Blobs used in the Function App.
As the last configuration option, you have the option to Add Application Insights to the function app. If you select On, the application insights resource will be created automatically and be configured in to the Function App. Finally click on the Createbutton (2) to create the Function App.
To navigate to the newly created Function App, on the Left Side menu click on Azure Functions Link. This will take you to a blade that will show all the Function Apps created for the subscription. From the list of function apps, click on the function app we just created. The blade will change with some additional UI elements. Let’s talk about each area in the Function App UI.
At the moment, the Function App does not have any Functions in it. To create a new Function, you can click on the Blue Plusbutton (1) in front of the Functions accordion menu in the left side of the blade. The blade will update with the UI to quickly create a function using the provided templates. In this UI, you can quickly start with 3 Scenarios given ***(1)***once you selected the scenario, then you can select the Language you want (2) and click on the Create this Function button (3) to create the function.
You can also ignore the quick start scenarios and go in to more detailed template selection UI by clicking on Custom Function link (4) this will give you more templates and language options to create a function. We will look at this UI in a later article.
Going back to the main UI of the function app, we will now talk about the different tabs available for function apps.
In the Overview tab, you can see the status of the function app and some other details including the Subscription, Resource Group, the URL of the function, Location and Pricing Tier (2). Above this section there are a row of buttons (3) including actions to Stop, Restart function app, Download the publish profile so that we can deploy to the function app from Visual Studio, reset publish credentials, Download the app Content and finally to Delete the function app.
In the settings tab, there are few important settings related to the function app. First you have the Daily Usage Quota ***(1)***where you can set the daily usage cap in GigabyteSeconds (Gb-Sec) units. This is for Consumption plan as we talked about in the previous article where we can control the daily usage of the function app. Bellow that we have a link to Application settings called Manage Application Settings (2) where by clicking on a blade will open up with Application Settings similar to the one you see in App Service Web Apps. If you remember the last article, we talked about how Function Apps are built on top of the Azure App Service.
Next is Proxies (3) which is a preview feature available for Azure Function Apps. Proxies is a new feature that makes it easy to develop APIs using Azure Functions and lets you define a single API surface for multiple Function Apps. Using this setting you can turn On/Off proxies for this specific Function App. You can read more about proxies using the following link.
Next you find the toggle for Function App Edit Mode (4) were you can switch the app from Read/Write mode where you can edit the function inside of the portal and Switch to Read Only where you cannot edit but only view the function code in the portal. This is normally set to Read Only when you do deployment to Function Apps from Source Control.
Then you have Slots (5) which is also a preview feature for Azure Functions where it similar to the Deployment Slots feature provided by App Service Web Apps that provide very useful feature like Hot Deployments where there is Zero Downtime, easy roll out and roll back of the application and many more.
Finally, you have Host Keys (6) that are common for all functions created in this Function app that can be used to Authentication for functions. Each function has its own Function Keys that is only available for that particular function. But Host Keys can be used regardless of which function it is used in the Function App. You can View, Copy, Renew and Revoke these keys from this section.
Platform Features Tab
Next up is the Platform Features Tab where you have access to numerous settings related to the Function app, these include Application Settings, Deployment Options, SSL & Custom Domain Configuration, Authentication etc. (1) If you are familiar with Azure App Service Web Apps and its platform options, this is the exact same configuration options available for Azure Functions. Remember, Azure Functions are built on top of Azure App Service.
API Definition Tab
API Definition is another preview feature available for Function Apps where you can use Swagger Metadata to define the functionality of your API allowing a Function App hosting a REST API to be consumed by a wide variety of third party services.
You have the option to configure an external URL for Swagger Metadata or by clicking on Function button you get an UI that will allow you to use an OpenAPI Editor to create the OpenAPI Document with the functionality to autogenerate the API Definition by scanning your Function app for HTTP triggred functions and use the functions.json file to automatically generate the OpenAPI Document. We will talk about these features in a later article.
That was a quick overview of the Azure Functions editor in Azure Portal to get you familiar with the UI and its features. In the next article, we will create couple of simple functions using the Azure Portal to get a full understanding on how to use the Azure Portal to create function apps. I’ll see you in the next article.
For more from Kasun, check out his blog