Maven Plugin for Azure Functions

Maven Central

Table of Content


Tool Required Version
JDK 1.8
Maven 3.0 and above
.Net Core SDK Latest version
Azure Functions Core Tools 2.0 and above

Note: See how to install Azure Functions Core Tools - 2.x



  • Scan the output directory (default is ${project.basedir}/target/classes) and generating function.json for each function (method annotated with FunctionName) in the staging directory.
  • Copy JAR files from the build directory (default is ${project.basedir}/target/) to the staging directory.

The default lifecycle phase for azure-functions:package is package. You can simply run mvn package to generate all the outputs you need to run/deploy your project.

Default staging directory is ${project.basedir}/target/azure-functions/${function-app-name}/


  • Create a new Java function and add to the current project.
  • You will be prompted to choose a template and enter parameters. Templates for below triggers are supported as of now:
    • HTTP Trigger
    • Azure Storage Blob Trigger
    • Azure Storage Queue Trigger
    • Timer Trigger
    • Event Grid Trigger
    • Event Hub Trigger
    • Cosmos DB Trigger
    • Service Bus Queue Trigger
    • Service Bus Topic Trigger


  • Invoke Azure Functions Local Emulator to run all functions. Default working directory is the staging directory.


  • Deploy the staging directory to target Azure Functions.
  • If target Azure Functions does not exist already, it will be created.


To use the Maven Plugin for Azure Functions in your Maven Java app, add the following snippet to your pom.xml file:


Read How-To section to learn detailed usages.

Common Configuration

This Maven plugin supports common configurations of all Maven Plugins for Azure. Detailed documentation of common configurations is at here.


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.
<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:
<deploymentType> false Specifies the deployment approach you want to use.
The default value is zip. When <deploymentType> is zip and WEBSITE_RUN_FROM_PACKAGE in appSettings values 1, the function will be deployed and run from package, you may visit here for more information.
<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;

*: 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. All valid App Service plan pricing tiers are listed as below. Read more at Azure App Service Plan Pricing.

  • F1
  • D1
  • B1
  • B2
  • B3
  • S1
  • S2
  • S3
  • P1V2
  • P2V2
  • P3V2


Generate the function archetype

Run below command to generate the function archetype:

mvn archetype:generate -DarchetypeArtifactId=azure-functions-archetype

Add new function to current project

Run below command to create a new function:

  • In package com.your.package
  • Named NewFunction
  • Bound to HttpTrigger
mvn azure-functions:add -Dfunctions.package=com.your.package -Dfunctions.template=HttpTrigger

You don't have to provide all the properties on the command line. Missing properties will be prompted for input during the execution of the goal.

Generate function.json from current project

Follow below instructions, you don't need to handwrite function.json anymore.

  1. Use annotations from package to decorate your functions.
  2. Run mvn clean package; then function.json files will be automatically generated for all functions in your project.

Run Azure Functions locally

With the help of goal azure-functions:run, you can run your Azure Functions in current project locally with below command:

mvn azure-functions:run

If you want to start the function host in debug mode, please add -DenableDebug as the argument. The function host use TCP-Socket Transport and listen on 5005 port by default, you may change the config string in configuration properties.

mvn azure-functions:run -DenableDebug

Note: Before you can run Azure Functions locally, install .Net Core SDK and Azure Functions Core Tools first.

Deploy Azure Functions to Azure

Directly deploy to target Azure Functions by running mvn azure-functions:deploy.

Supported deployment methods are listed as below. The default value is ZIP.

  • ZIP

Add Proxies Configuration to Your Azure Function

Azure Functions proxies can be used for things like URL rewriting. To include a proxies.json file in your deployment you need to add it to the maven-resources-plugin configuration in pom.xml alongside host.json and local.settings.json.

For example, if you had a function bound to the path api/index which you wanted to also expose at the root URL of your Functions app you can do that with a proxies.json like this:

  "$schema": "",
  "proxies": {
    "IndexProxy": {
      "matchCondition": {
        "route": "/"
      "backendUri": "https://%WEBSITE_HOSTNAME%/api/index"

Common Questions

Q: Can I upload other static content, e.g. HTML files, as part of the function deployment?

A: You can achieve this by adding configurations for the maven-resources-plugin. For example:

          <!-- Your static resources -->