Web App

Overview

The Web App builder is used to create Azure App Service accounts. It abstracts the Service Plan into the same component, and will also create and configure a linked App Insights resource. If you wish to create a website that connects to an existing service plan, use the link_to_service_plan keyword and provide the resource name of the service plan to connect to.

  • Web Site (Microsoft.Web/sites)
  • Web Host (Microsoft.Web/serverfarms)
  • Application Insights (Microsoft.Insights/components)
  • Site Extension (siteextensions)

Web App Builder Keywords

Applies ToKeywordPurpose
Web AppnameSets the name of the web app.
Web Applink_to_service_planInstructs Farmer to link this webapp to an existing service plan rather than creating a new one.
Web Appapp_insights_auto_nameSets the name of the automatically-created app insights instance.
Web Appapp_insights_offRemoves any automatic app insights creation, configuration and settings for this webapp.
Web Applink_to_app_insightsInstead of creating a new AI instance, configure this webapp to point to another AI instance that you are managing yourself.
Web Apprun_from_packageSets the web app to use “run from package” deployment capabilities.
Web Appwebsite_node_default_versionSets the node version of the web app.
Web AppsettingSets an app setting of the web app in the form “key” “value”.
Web AppsettingsSets a list of app setting of the web app as tuples in the form of (“key”, “value”).
Web Apphttps_onlyDisables http for this webapp so that only HTTPS is used.
Web Appdepends_onSets a dependency for the web app.
Web Appdocker_imageSets the docker image to be pulled down from Docker Hub, and the command to execute as a second argument. Automatically sets the OS to Linux.
Web Appdocker_ciTurns on continuous integration of the web app from the Docker source repository using a webhook.
Web Appdocker_use_azure_registryUses the supplied Azure Container Registry name as the source of the Docker image, instead of Docker Hub. You do not need to specify the full url, but just the name of the registry itself.
Service Planservice_plan_nameSets the name of the service plan. If not set, uses the name of the web app postfixed with “-plan”.
Service Planalways_onSets “Always On” flag.
Service Planruntime_stackSets the runtime stack.
Service Planoperating_systemSets the operating system. If Linux, App Insights configuration settings will be omitted as they are not supported by Azure App Service.
Service PlanskuSets the sku of the service plan.
Service Planworker_sizeSets the size of the service plan worker.
Service Plannumber_of_workersSets the number of instances on the service plan.

Farmer also comes with a dedicated Service Plan builder that contains all of the above keywords that apply to a Service Plan.

Use this builder if you wish to have an explicit and clear separation between your web app and service plan. Otherwise, it is recommended to use the service plan keywords that exist directly in the web app builder, and let Farmer handle the connections between them.

Post-deployment Builder Keywords

The Web App builder contains special commands that are executed after the ARM deployment is completed.

KeywordPurpose
zip_deploySupplying a folder or zip file will instruct Farmer to upload the contents directly to the App Service once the ARM deployment is complete.

Configuration Members

MemberPurpose
PublishingPasswordGets the ARM expression path to the publishing password of this web app.
ServicePlanGets the Resource Name of the service plan for this web app.
AppInsightsGets the Resource Name of the service plan for the AI resource linked to this web app.

Example

open Farmer
open Farmer.Builders

let myWebApp = webApp {
    name "myWebApp"
    service_plan_name "myServicePlan"
    setting "myKey" "aValue"
    sku WebApp.B1
    always_on
    app_insights_off
    worker_size Medium
    number_of_workers 3
    run_from_package
}