Skip to content

Azure Functions: Configuration Details

Hanxiao Liu edited this page Jul 1, 2024 · 21 revisions

Properties

This Maven Plugin supports the following configuration properties:

Property Required Description
<resourceGroup> true Specifies the Azure Resource Group for your Azure Functions.
<appName> true Specifies the name of your Azure Functions.
<region>* false Specifies the region where your Azure Functions will be hosted; default value is westus. All valid regions are at Supported Regions section.
<runtime> false The runtime environment configuration, default runtime is windows. Details could be found in runtime section.
<pricingTier>* false Specifies the pricing tier for your Azure Functions; default value is Consumption. All valid pricing tiers are at Supported Pricing Tiers section.
<appServicePlanResourceGroup> false Specifies the resource group of the existing App Service Plan when you do not want to create a new one. If this setting is not specified, the plugin will use the value defined in <resourceGroup>.
<appServicePlanName> false Specifies the name of the existing App Service Plan when you do not want to create a new one.
<appSettings> false Specifies the application settings for your Azure Functions, which are defined in name-value pairs like following example:
<property>
    <name>xxxx</name>
    <value>xxxx</value>
</property>
<deploymentType> false Specifies the deployment approach you want to use. All valid regions are at Supported Deployment Type section.
<httpProxyHost> false Specifies an optional HTTP proxy to connect to Azure through.
<httpProxyPort> false Specifies an optional HTTP proxy port to connect to Azure through
The default value is 80.
<localDebugConfig> false The config string of debug options, you may visit here for more information. The default value is transport=dt_socket,server=y,suspend=n,address=5005;
<appInsightsKey> false Specifies the instrumentation key of application insights which will bind to your function app.
<appInsightsInstance> false Specifies the name of application insights which will bind to your function app, must be in the same resource group with function app.
<disableAppInsights> false Specifies whether to disable application insights for your function app, default value is false.
<deploymentSlot> false Specifies deployment slot name and its configuration source when create or update deployment slots, refers DeploymentSlot for details
<hostJson> false Path for host json file, default to be host.json in project root
<localSettingsJson> false Path for func local settings file, default to be local.settings.json in project root
<funcPort> false Config port for function local host, default to be 7071
<artifactPath> false Path for the artifact to package and deploy, by default maven plugin will use artifact build by maven
<skipCopyDependencies> false Boolean flag to control whether to skip copy dependencies to staging directory, please set this to true if you use your own fat jar with <artifactPath>, default value is false
<buildJarWithDependencies> false (Preview) Boolean flag to control whether to build fat jar during azure-functions:package, default value is false, refers Fat Jar for details

Properties for Azure Container Apps hosting of Azure Functions

Property Required Description
<environment> false The azure container apps environment to hold function app, in this case, function runtime could only be docker, please refer runtime for details. If this is not configured, toolkit will run the function app with app service plan.
<workloadProfileName> false The workload profile name to run the function app on, default value is Consumption
<cpu> false The CPU in cores of the container host function app. e.g 0.75.
<memory> false The memory size of the container host function app. e.g. 1.0Gi. Only works for container host function app

Properties for Flex Consumption Function App

Property Required Description
<instanceMemory> false Set the amount of memory allocated to each instance of the function app in MB. CPU and network bandwidth are allocated proportionally. Values must be one of 512, 2048, 4096 and default value is 2048
<maximumInstances> false The maximum number of instances for the function app. Value must be in range [40, 1000] and default value is 100
<deploymentStorageAccount> false The storage account which is used to store deployment artifacts. If not specified, will use account defined with for deployment
<deploymentStorageResourceGroup> false The resource group of the storage account which is used to store deployment artifacts.
<deploymentStorageContainer> false The container in the storage account which is used to store deployment artifacts.
<storageAuthenticationMethod> false The authentication method to access the storage account for deployment. Available options: SystemAssignedIdentity, UserAssignedIdentity, StorageAccountConnectionString.
<userAssignedIdentityResourceId> false Set the resource ID of the identity, required for UserAssignedIdentity authentication.
<storageAccountConnectionString> false Set the name of the app setting that has the storage account connection string, used when use StorageAccountConnectionString authentication.
<alwaysReadyInstances> false Always ready instances config for flex consumption function app, in the form of name-value pairs.
<httpInstanceConcurrency> false Concurrency for http triggers.

*: This setting will be used to create a new Azure Functions if specified Azure Functions does not exist; if target Azure Functions already exists, this setting will be ignored.

Supported Regions

All valid regions are listed as below. Read more at Azure Region Availability.

  • westus
  • westus2
  • eastus
  • eastus2
  • northcentralus
  • southcentralus
  • westcentralus
  • canadacentral
  • canadaeast
  • brazilsouth
  • northeurope
  • westeurope
  • uksouth
  • eastasia
  • southeastasia
  • japaneast
  • japanwest
  • australiaeast
  • australiasoutheast
  • centralindia
  • southindia

Supported Pricing Tiers

Consumption plan is the default if you don't specify anything for your Azure Functions.

You can also run Functions within your App Service Plan. Both Premium plan and Dedicated plan are suported. All valid pricing tiers are listed as below. Read more at Azure App Service Plan Pricing.

Supported Runtime

Supported <os> values are Linux, Windows and Docker.

For windows/linux function, please set runtime java version with <javaVersion>, supported values are 8, 11 and 17

<runtime>
    <os>windows</os>
    <javaVersion>8</javaVersion>
</runtime>

Note: If the <javaVersion> is not configured, Java 8 will be used by default

For docker runtime function (either runs on service plan or container apps environment), please please set the following parameters.

<runtime>
    <os>docker</os>
    <image>[hub-user/]repo-name[:tag]</image>
    <serverId></serverId>
    <registryUrl></registryUrl> <!- could be omitted for docker hub images -->
</runtime>

For private docker images, please set your username and password in maven settings.xml and refer it with <serverId> in runtime configuration, below is an example

...
<servers>
...
    <server>
        <id>SERVER_ID</id>
        <username> </username>
        <password> </password>
    </server>
</servers>

Supported Deployment Type

Maven plugin will select deployment method by runtime configuration automatically:

  • For Windows Function Apps, the default deployment method is RUN_FROM_ZIP
  • For Linux Function Apps, RUN_FROM_BLOB will be used for apps with Consumption and Premium App Service Plan, RUN_FROM_ZIP will be used for apps with Dedicated App Service Plan.

All valid deployment type are listed as below.

  • FTP
  • ZIP
  • MSDEPLOY
  • RUN_FROM_ZIP
  • RUN_FROM_BLOB

Note: Both RUN_FROM_ZIP and RUN_FROM_BLOB are implement of run from package, RUN_FROM_ZIP will deploy the artifact with ZIP deploy and set WEBSITE_RUN_FROM_PACKAGE to 1; RUN_FROM_BLOB will upload the artifact to blob storage and set WEBSITE_RUN_FROM_PACKAGE to correspond blob url.

Deployment Slot

Azure Functions deployment slots allow your function app to run different instances called "slots", slots are different environments exposed via a publicly available endpoint. For details about deployment slot, please refer this document.

For maven plugin, we also provide deployment slot which could help you create a new deployment slot or updating the existing one, below is the configuration schema.

Property Required Description
<name> true Specifies the deployment slot name
<configurationSource> false Specifies the configuration source of new created deployment slot, could be parent or existing deployment slot name, default value is parent
<deploymentSlot>
    <name>demo-slot</name>
    <configurationSource>parent</configurationSource>
</deploymentSlot>

Fat Jar

Functions maven plugin will use artifact build by maven compiler plugin for local run and deployment by default, and dependencies will be copied to lib folder of staging directory, however, this may affect the performance of function host cold start. To resolve this issue, you may use artifact with dependencies (fat jar), and functions maven plugin could help you build fat jar with <buildJarWithDependencies> set to true.

To build fat jar, we will call maven-shade-plugin with following configuration, you may also provide your own fat jar with <artifactPath>, in this case, please set <skipCopyDependencies> to true as well.

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-shade-plugin</artifactId>
	<version>3.4.1</version>
	<executions>
		<execution>
			<phase>package</phase>
			<goals>
				<goal>shade</goal>
			</goals>
			<configuration>
				<filters>
					<filter>
						<artifact>*:*</artifact>
						<excludes>
							<exclude>META-INF/*.SF</exclude>
							<exclude>META-INF/*.DSA</exclude>
							<exclude>META-INF/*.RSA</exclude>
						</excludes>
					</filter>
				</filters>
				<transformers>
					<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
					<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
					<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
				</transformers>
			</configuration>
		</execution>
	</executions>
</plugin>
Clone this wiki locally