Functions

Overview

The Functions builder is used to create Azure Functions accounts. It abstracts the App Host and Service Plan into the same component, and will also create and configure a linked App Insights resource. In addition, it will automatically create a backing storage account required by the functions runtime.

  • Web Site (Microsoft.Web/sites)
  • Web Host (Microsoft.Web/serverfarms)
  • Application Insights (Microsoft.Insights/components)
  • Storage Accounts (Microsoft.Storage/storageAccounts)

Builder Keywords

KeywordPurpose
nameSets the name of the functions instance.
service_plan_nameSets the name of the service plan hosting the function instance.
link_to_service_planInstructs Farmer to link this webapp to an existing service plan rather than creating a new one.
link_to_storage_accountDo not create an automatic storage account; instead, link to a storage account that is created outside of this Functions instance.
https_onlyDisables http for this functions app so that only HTTPS is used.
app_insights_auto_nameSets the name of the automatically-created app insights instance.
app_insights_offRemoves any automatic app insights creation, configuration and settings for this webapp.
link_to_app_insightsInstead of creating a new AI instance, configure this webapp to point to another AI instance that you are managing yourself.
use_runtimeSets the runtime of the Functions host.
use_extension_versionSets the extension version of the functions host.
operating_systemSets the operating system of the Functions host.
settingSets an app setting of the web app in the form “key” “value”.
depends_onSets a dependency for the web app.

Configuration Members

MemberPurpose
PublishingPasswordGets the ARM expression path to the publishing password of this functions app.
StorageAccountKeyGets the ARM expression path to the storage account key of this functions app.
AppInsightsKeyGets the ARM expression path to the app insights key of this functions app, if it exists.
DefaultKeyGets the ARM expression path for the default key of this functions app.
MasterKeyGets the ARM expression path for the master key of this functions app.

Example

open Farmer
open Farmer.Builders

let myFunctions = functions {
    name "myWebApp"
    service_plan_name "myServicePlan"
    setting "myKey" "aValue"
    app_insights_off
}```