Deploy Cuba App to Azure

How do you deploy a Cuba App to an Azure App Service?
App Service Configuration:
Java 8
Tomcat 9
Plan: Free

I added the following to the end of the build.gradle file

configurations {
ftpAntTask
}

dependencies {
ftpAntTask(“org.apache.ant:ant-commons-net:1.9.+”);
}

ant.taskdef(
name: ‘ftp’,
classname: ‘org.apache.tools.ant.taskdefs.optional.net.FTP’,
classpath: configurations.ftpAntTask.asPath
)

task buildWarAndDeployAzure(type: CubaWarBuilding) {
def contextFile = ‘modules/core/web/META-INF/context.xml’
def appHostName = ‘hostname’
def ftpHostName = ‘ftphostname’
def ftpUserName = ‘username’
def ftpPassword = ‘password’
singleWar = true
// config ends
appHome = ‘/home/site/wwwroot/webapps’
coreContextXmlPath = contextFile
includeJdbcDriver = true
includeContextXml = true

appProperties = [
        'cuba.automaticDatabaseUpdate'       : true,
        'cuba.logDir'                        : '/home/LogFiles',
        'cuba.webAppUrl'                     : 'https://' + appHostName + '/app',
        'cuba.webHostName'                   : appHostName,
        'cuba.webPort'                       : 443,
        'cuba.web.loginDialogDefaultUser'    : 'admin',
        'cuba.web.loginDialogDefaultPassword': 'admin'
]

if (singleWar) {
    includeContextXml = true
    webXmlPath = 'modules/web/web/WEB-INF/single-war-web.xml'
    appProperties.put('cuba.useLocalServiceInvocation', true)
} else {
    appProperties.put('cuba.connectionUrlList', 'https://' + appHostName + '/app-core')
}

doLast {
    def webApps = 'site/wwwroot/webapps'
    def buildDir = 'build/distributions/war'

    ant.ftp(action: 'del', server: ftpHostName, remotedir: webApps, userid: ftpUserName, password: ftpPassword) {
        fileset(includes: '*.war')
    }

    ant.ftp(server: ftpHostName, remotedir: webApps, userid: ftpUserName, password: ftpPassword) {
        fileset(dir: buildDir, includes: '*.war')
    }
}

}

In the context.xml file

<!-- Database connection -->
<Resource driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
          maxIdle="2"
          maxTotal="20"
          maxWaitMillis="5000"
          name="jdbc/CubaDS"
          password="*****"
          type="javax.sql.DataSource"
          url="jdbc:sqlserver://servername;databaseName=databasename"
          username="dbusername"
          validationQuery="select 1"/>

And the single-war-web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!-- Web Client parameters -->

<context-param>
    <description>List of app properties files for Web Client</description>
    <param-name>appPropertiesConfigWeb</param-name>
    <param-value>
        classpath:com/company/prms/web-app.properties
        /WEB-INF/local.app.properties
        "file:${app.home}/local.app.properties"
    </param-value>
</context-param>


<!-- Middleware parameters -->

<context-param>
    <description>List of app properties files for Middleware</description>
    <param-name>appPropertiesConfigCore</param-name>
    <param-value>
        classpath:com/company/prms/app.properties
        /WEB-INF/local.app.properties
        "file:${app.home}/local.app.properties"
    </param-value>
</context-param>
<!--Application components-->
<context-param>
    <param-name>appComponents</param-name>
    <param-value>com.haulmont.cuba com.haulmont.reports</param-value>
</context-param>

<!-- Servlet context listeners that load the application blocks -->

<listener>
    <listener-class>com.haulmont.cuba.core.sys.singleapp.SingleAppCoreServletListener</listener-class>
</listener>
<listener>
    <listener-class>com.haulmont.cuba.web.sys.singleapp.SingleAppWebServletListener</listener-class>
</listener>