azure-gradle-plugins/azure-webapp-gradle-plugin
Nils Druyen de2204ee8f
Add kotlin dsl example to README.md (#107)
2021-08-24 07:58:33 +08:00
..
src/main Fix the targetCompatibility and adopt proxy changes supporting proxy with credentials. (#102) 2021-08-16 10:40:03 +08:00
CHANGELOG.md add readme for webapp gradle plugin (#99) 2021-07-30 16:44:05 +08:00
README.md Add kotlin dsl example to README.md (#107) 2021-08-24 07:58:33 +08:00
build.gradle update build.gradle to merge common configurations tasks, upgrade gradle to 6.8 and update checkstyle rule (#104) 2021-08-20 09:45:07 +08:00
gradle.properties bump version (#105) 2021-08-20 10:52:25 +08:00
settings.gradle Add gradle webapp plugin (#90) 2021-07-21 11:02:47 +08:00

README.md

Azure WebApp Plugin for Gradle

Gradle Plugin Portal

This plugin helps Java developers to deploy Maven projects to Azure App Service.

Prerequisites

Tool Required Version
JDK 1.8
Gradle 5.2 and above

Setup

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

plugins {
  id "com.microsoft.azure.azurewebapp" version "1.0.0"
}

Configuration

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

Groovy DSL

azurewebapp {
    subscription = '<your subscription id>'
    resourceGroup = '<your resource group>'
    appName = '<your app name>'
    pricingTier = '<price tier like 'P1v2'>'
    region = '<region like 'westus'>'
    runtime {
      os = 'Linux'
      webContainer = 'Tomcat 9.0' // or 'Java SE' if you want to run an executable jar
      javaVersion = 'Java 8'
    }
    appSettings {
        <key> = <value>
    }
    auth {
        type = 'azure_cli' // support azure_cli, oauth2, device_code and service_principal
    }
}

Kotlin DSL

azurewebapp {
  subscription = "<your subscription id>"
  resourceGroup = "<your resource group>"
  appName = "<your app name>"
  pricingTier = "<price tier like 'P1v2'>"
  region = "<region like 'westus'>"
  setRuntime(closureOf<com.microsoft.azure.gradle.configuration.GradleRuntimeConfig> {
    os("Linux")
    webContainer("Java SE")
    javaVersion("Java 11")
  })
  setAppSettings(closureOf<MutableMap<String, String>> {
    put("key", "value")
  })
  setAuth(closureOf<com.microsoft.azure.gradle.auth.GradleAuthConfig> {
    type = "azure_cli"
  })
}

Usage

Deploy your web project to Azure App Service

gradle azureWebAppDeploy

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.