Manage your function app

In Azure Functions, a function app provides the execution context for your private functions. Function app behaviors apply to all functions hosted by a given part app. All functions in a function app must exist of the same linguistic communication.

Individual functions in a function app are deployed together and are scaled together. All functions in the same function app share resources, per instance, as the part app scales.

Connection strings, surround variables, and other application settings are divers separately for each role app. Any data that must be shared between function apps should be stored externally in a persisted store.

Get started in the Azure portal

  1. To begin, go to the Azure portal and sign in to your Azure account. In the search bar at the top of the portal, enter the name of your function app and select it from the list.

  2. Under Settings in the left pane, select Configuration.

    Function app overview in the Azure portal

You can navigate to everything you demand to manage your function app from the overview folio, in particular the Application settings and Platform features.

Work with application settings

Y'all can create any number of application settings required past your part lawmaking. There are as well predefined application settings used by Functions. To acquire more, see the App settings reference for Azure Functions.

These settings are stored encrypted. To larn more, run across Awarding settings security.

Application settings can be managed from the Azure portal and by using the Azure CLI and Azure PowerShell. Yous tin as well manage application settings from Visual Studio Code and from Visual Studio.

  • Portal
  • Azure CLI
  • Azure PowerShell

To find the application settings, see Get started in the Azure portal.

The Application settings tab maintains settings that are used past your function app. Yous must select Evidence values to see the values in the portal. To add together a setting in the portal, select New application setting and add the new key-value pair.

Function app settings in the Azure portal.

Use application settings

The role app settings values can also be read in your code as environment variables. For more information, see the Surroundings variables section of these language-specific reference topics:

  • C# precompiled
  • C# script (.csx)
  • F# script (.fsx)
  • Java
  • JavaScript
  • PowerShell
  • Python

When you develop a function app locally, you must maintain local copies of these values in the local.settings.json project file. To larn more, see Local settings file.

Hosting plan type

When yous create a function app, you also create a hosting plan in which the app runs. A plan can have one or more role apps. The functionality, scaling, and pricing of your functions depend on the type of programme. To learn more than, see Azure Functions hosting options.

You can make up one's mind the type of program being used by your part app from the Azure portal, or by using the Azure CLI or Azure PowerShell APIs.

The following values indicate the programme type:

Plan blazon Portal Azure CLI/PowerShell
Consumption Consumption Dynamic
Premium ElasticPremium ElasticPremium
Dedicated (App Service) Various Various
  • Portal
  • Azure CLI
  • Azure PowerShell

To decide the type of plan used by your function app, come across App Service plan in the Overview tab for the part app in the Azure portal. To run across the pricing tier, select the name of the App Service Plan, and then select Backdrop from the left pane.

View scaling plan in the portal

Plan migration

You lot can use Azure CLI commands to migrate a office app between a Consumption plan and a Premium plan on Windows. The specific commands depend on the direction of the migration. Straight migration to a Defended (App Service) plan isn't currently supported.

This migration isn't supported on Linux.

Consumption to Premium

Utilise the following procedure to migrate from a Consumption plan to a Premium plan on Windows:

  1. Run the az functionapp plan create command as follows to create a new App Service plan (Rubberband Premium) in the same region and resource group as your existing office app:

                      az functionapp programme create --name <NEW_PREMIUM_PLAN_NAME> --resource-group <MY_RESOURCE_GROUP> --location <REGION> --sku EP1                                  
  2. Run the az functionapp update control every bit follows to migrate the existing role app to the new Premium plan:

                      az functionapp update --name <MY_APP_NAME> --resources-group <MY_RESOURCE_GROUP> --programme <NEW_PREMIUM_PLAN>                                  
  3. If you no longer need your previous Consumption function app plan, delete your original function app plan after confirming you take successfully migrated to the new ane. Run the az functionapp plan listing control equally follows to get a list of all Consumption plans in your resources group:

                      az functionapp plan list --resources-group <MY_RESOURCE_GROUP> --query "[?sku.family=='Y'].{PlanName:proper noun,Sites:numberOfSites}" -o table                                  

    You can safely delete the plan with zero sites, which is the one yous migrated from.

  4. Run the az functionapp plan delete command as follows to delete the Consumption plan you lot migrated from.

                      az functionapp plan delete --name <CONSUMPTION_PLAN_NAME> --resource-group <MY_RESOURCE_GROUP>                                  

Premium to Consumption

Use the following procedure to migrate from a Premium plan to a Consumption plan on Windows:

  1. Run the az functionapp plan create command as follows to create a new function app (Consumption) in the same region and resources grouping every bit your existing role app. This control also creates a new Consumption plan in which the function app runs.

                      az functionapp create --resource-group <MY_RESOURCE_GROUP> --proper noun <NEW_CONSUMPTION_APP_NAME> --consumption-plan-location <REGION> --runtime dotnet --functions-version 3 --storage-account <STORAGE_NAME>                                  
  2. Run the az functionapp update command as follows to migrate the existing function app to the new Consumption plan.

                      az functionapp update --name <MY_APP_NAME> --resources-group <MY_RESOURCE_GROUP> --plan <NEW_CONSUMPTION_PLAN> --force                                  
  3. Run the az functionapp delete command as follows to delete the function app you created in step 1, since you lot but demand the plan that was created to run the existing function app.

                      az functionapp delete --name <NEW_CONSUMPTION_APP_NAME> --resource-grouping <MY_RESOURCE_GROUP>                                  
  4. If you lot no longer need your previous Premium function app program, delete your original role app plan after confirming y'all have successfully migrated to the new i. Please notation that if the plan is non deleted, yous will notwithstanding exist charged for the Premium plan. Run the az functionapp plan listing control as follows to become a list of all Premium plans in your resources group.

                      az functionapp plan listing --resource-group <MY_RESOURCE_GROUP> --query "[?sku.family=='EP'].{PlanName:name,Sites:numberOfSites}" -o table                                  
  5. Run the az functionapp program delete control every bit follows to delete the Premium programme you migrated from.

                      az functionapp plan delete --name <PREMIUM_PLAN> --resource-grouping <MY_RESOURCE_GROUP>                                  

Get your function admission keys

HTTP triggered functions can generally be chosen by using a URL in the format: https://<APP_NAME>.azurewebsites.net/api/<FUNCTION_NAME>. When the authorization to your function is set a value other than anonymous, yous must too provide an access fundamental in your request. The admission key tin either be provided in the URL using the ?code= query string or in the asking header. To acquire more than, meet Part admission keys. There are several ways to get your access keys.

  • Portal
  • Azure CLI
  • Azure PowerShell
  1. Sign in to the Azure portal, then search for and select Function App.

  2. Select the function you want to verify.

  3. In the left navigation under Functions, select App keys.

    This returns the host keys, which can be used to access any function in the app. It likewise returns the organization central, which gives anyone administrator-level admission to the all function app APIs.

You tin can also practice least privilege by using the primal merely for the specific function key by selecting Function keys under Programmer in your HTTP triggered office.

Manually install extensions

C# class library functions can include the NuGet packages for binding extensions direct in the class library projection. For other not-.NET languages and C# script, the recommended way to install extensions is either by using extension bundles or past using Azure Functions Core Tools locally. If you tin can't use extension bundles and are merely able to work in the portal, you need to utilise Advanced Tools (Kudu) to manually create the extensions.csproj file straight in the site. Make sure to beginning remove the extensionBundle element from the host.json file.

This aforementioned process works for any other file you lot demand to add together to your app.

The Functions editor built into the Azure portal lets y'all update your office code and configuration (role.json) files directly in the portal.

  1. Select your function app, then under Functions select Functions.
  2. Choose your function and select Code + test under Developer.
  3. Choose your file to edit and select Save when you're done.

Files in the root of the app, such as function.proj or extensions.csproj demand to be created and edited by using the Advanced Tools (Kudu).

  1. Select your function app, then under Development tools select Avant-garde tools > Go.

  2. If promoted, sign-in to the SCM site with your Azure credentials.

  3. From the Debug panel carte du jour, cull CMD.

  4. Navigate to .\site\wwwroot, select the plus (+) button at the peak, and select New file.

  5. Proper noun the file, such every bit extensions.csproj and press Enter.

  6. Select the edit push next to the new file, add or update code in the file, and select Save.

  7. For a project file like extensions.csproj, run the following command to rebuild the extensions project:

                      dotnet build extensions.csproj                                  

Platform features

Role apps run in, and are maintained by, the Azure App Service platform. Equally such, your function apps have access to nearly of the features of Azure's core web hosting platform. When working in the Azure portal, the left pane is where you admission the many features of the App Service platform that you lot tin can use in your function apps.

The following matrix indicates portal feature support by hosting programme and operating system:

Feature Consumption plan Premium plan Dedicated plan
Advanced tools (Kudu) Windows: ✔
Linux: X
App Service editor Windows: ✔
Linux: X
Windows: ✔
Linux: X
Windows: ✔
Linux: 10
Backups X X
Console Windows: control-line
Linux: Ten
Windows: control-line
Linux: SSH
Windows: command-line
Linux: SSH

The residuum of this article focuses on the following features in the portal that are useful for your function apps:

  • App Service editor
  • Console
  • Advanced tools (Kudu)
  • Deployment options
  • CORS
  • Authentication

For more information well-nigh how to work with App Service settings, see Configure Azure App Service Settings.

App Service editor

The App Service editor

The App Service editor is an advanced in-portal editor that you tin can use to modify JSON configuration files and code files akin. Choosing this option launches a split browser tab with a bones editor. This enables you to integrate with the Git repository, run and debug code, and modify office app settings. This editor provides an enhanced development surroundings for your functions compared with the built-in part editor.

We recommend that you consider developing your functions on your local reckoner. When you develop locally and publish to Azure, your project files are read-just in the portal. To acquire more, meet Code and test Azure Functions locally.

Console

Function app console

The in-portal panel is an ideal developer tool when you lot prefer to collaborate with your office app from the command line. Common commands include directory and file cosmos and navigation, as well every bit executing batch files and scripts.

When developing locally, we recommend using the Azure Functions Cadre Tools and the Azure CLI.

Advanced tools (Kudu)

Configure Kudu

The advanced tools for App Service (also known as Kudu) provide access to advanced administrative features of your role app. From Kudu, you manage organization information, app settings, environment variables, site extensions, HTTP headers, and server variables. You tin can also launch Kudu by browsing to the SCM endpoint for your function app, like https://<myfunctionapp>.scm.azurewebsites.net/

Deployment Eye

When you use a source control solution to develop and maintain your functions lawmaking, Deployment Center lets you build and deploy from source control. Your projection is built and deployed to Azure when yous brand updates. For more information, see Deployment technologies in Azure Functions.

Cross-origin resource sharing

To prevent malicious lawmaking execution on the client, mod browsers block requests from web applications to resources running in a dissever domain. Cantankerous-origin resource sharing (CORS) lets an Access-Command-Allow-Origin header declare which origins are allowed to telephone call endpoints on your function app.

Portal

When you configure the Allowed origins listing for your function app, the Admission-Control-Allow-Origin header is automatically added to all responses from HTTP endpoints in your function app.

Configure function app's CORS list

When the wildcard (*) is used, all other domains are ignored.

Use the az functionapp cors add control to add a domain to the allowed origins list. The post-obit instance adds the contoso.com domain:

              az functionapp cors add together --name <FUNCTION_APP_NAME> \ --resources-group <RESOURCE_GROUP_NAME> \ --immune-origins https://contoso.com                          

Use the az functionapp cors testify command to listing the current allowed origins.

Authentication

Configure authentication for a function app

When functions utilize an HTTP trigger, y'all can require calls to first exist authenticated. App Service supports Azure Agile Directory hallmark and sign-in with social providers, such as Facebook, Microsoft, and Twitter. For details on configuring specific authentication providers, run into Azure App Service hallmark overview.

Next steps

  • Configure Azure App Service Settings
  • Continuous deployment for Azure Functions