azure-gradle-plugins/azure-functions-gradle-plugin
Andy Xu(devdiv) e56b207bc4
Update dependency version (#85)
2021-06-29 09:27:43 +08:00
..
gradle Prepare release pipeline (#36) 2020-03-05 09:44:09 +08:00
src Add missing telemetries for Functions gradle plugin (#84) 2021-03-25 12:01:36 +08:00
CHANGELOG.md Prepare new release: 1.5.0 (#67) 2020-09-23 16:27:55 +08:00
README.md Update README.md (#70) 2020-09-24 11:27:34 +08:00
build.gradle Update dependency version (#85) 2021-06-29 09:27:43 +08:00
gradle.properties Add missing telemetries for Functions gradle plugin (#84) 2021-03-25 12:01:36 +08:00
gradlew Merge develop to master (#19) 2020-02-08 12:03:15 +08:00
gradlew.bat Merge develop to master (#19) 2020-02-08 12:03:15 +08:00

README.md

Azure Functions Plugin for Gradle

Gradle Plugin Portal

This plugin provides seamless integration into Gradle projects. You can package a Java Functions project, run it locally or deploy it to Azure with tasks provided by this plugin.

Prerequisites

Tool Required Version
JDK 1.8
Gradle 4.10 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

Setup

In your Gradle Java project, add the plugin to your build.gradle:

plugins {
  id "com.microsoft.azure.azurefunctions" version "1.5.0"
}

Configuration

Here is a sample configuration, for details, please refer to this document.

azurefunctions {
    subscription = <your subscription id>
    resourceGroup = <your resource group>
    appName = <your function app name>
    pricingTier = <price tier like 'Consumption'>
    region = <region like 'westus'>
    runtime {
      os = <os like 'windows'>
    }
    appSettings {
        <key> = <value>
    }

    authentication {
        type = 'azure_cli' 
    }
    // enable local debug 
    // localDebug = "transport=dt_socket,server=y,suspend=n,address=5005"
    deployment {
        type = 'run_from_blob'
    }
}

Usage

Package Staging folder

Use the script below to to package your staging folder:

gradle azureFunctionsPackage

or package the staging folder with a zip file:

gradle azureFunctionsPackageZip

Run Azure Functions locally

Use the script below to run the function locally, if you want to debug your functions, please add localDebug = "transport=dt_socket,server=y,suspend=n,address=5005" to the azurefunctions section of your build.gradle.

gradle azureFunctionsRun

Deploy Azure Functions to Azure Cloud

gradle azureFunctionsDeploy

Common Questions

Q: How to do when reporting "Cannot run functions locally due to error: Azure Functions Core Tools can not be found."

A: You can install Azure Functions Core Tools at: https://aka.ms/azfunc-install

Feedback and Questions

To report bugs or request new features, file issues on Issues. Or, ask questions on Stack Overflow with tag azure-java-tools.

Data and Telemetry

This project collects usage data and sends it to Microsoft to help improve our products and services. Read Microsoft's privacy statement to learn more. If you would like to opt out of sending telemetry data to Microsoft, you can set allowTelemetry to false in the plugin configuration. Please read our document to find more details about allowTelemetry.