Commercial & Government Azure Function Deployment Tips, Part 2

John E. Huschka, April 14, 2018

Target Audience:

Azure Developer

Technology:

Azure Functions — Internet cloud based custom web-accessible code.

Azure Resource Manager Templates — Files in which you can group your Azure resources for deployment.

In our series introduction, we provided important background information on Azure functions, the Azure components that support them, and Azure Resource Manager’s deployment templates. In this post, we will cover the deployment differences related to your selected app service plan.

This post is part of our blog series and demonstration code on deploying Azure Commercial and Government functions.

Tip #1: Select the Correct App Service Plan

This is a critical setting in your ARM template because it will drive other configuration differences.

Our Commercial ARM template is configured to deploy our function under a consumption plan (which provides function resources dynamically):

Whereas, our Government ARM template is configured to deploy our function under a standard app service plan (which dedicates fixed resources to the function) because the consumption plan is not available in Azure Government.

For basic information regarding the available SKUs, see App Service pricing and App Service plans.

You may also find it helpful to look at Azure portal blade on which you create a new app service because it details the plans available in your specific environment. Note, however, that this blade will not show the availability of the "Consumption" plan in the Azure Commercial portal.

Tip #2: Set Always On if Needed

Always On indicates that your function is to remain running and always available.

There are two scenarios under which the setting is not available and does not apply:

  • Functions running under “free” or “shared” app service plans, because functions running under these non-dedicated plans cannot run continuously.
  • Functions running under a “consumption” plan, because the consumption plan manages the availability of the function.

In short, it applies if you are running under an app service plan of basic and above.

If your function is triggered by HTTP request (such as a webhook), Always On can be set to false. If it is triggered by other means (such as a schedule or blob trigger), you must set it to true to ensure that your function runs.

Our Government ARM template is configured to deploy our function with Always On as false, because our webhook is trigged by an HTTP call.

{
    "comments": "Webhook Function App Service Configuration (Application Settings)",
    "type": "Microsoft.Web/sites/config",
    "name": "[concat(parameters('appServiceName'), '/web')]",