Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
I had a great opportunity to work with a partner to pilot the use of Java Azure Functions for a Java based PDF report generator. I'm more of a C#/.NET, C++, and Python dev and my partner mostly builds on LAMP bar the Java Based PDF generator, so day to day is not Java Development.
If this sounds like you and Java dev is not your core then read on as this post augments existing documentation for the preview of Java based Azure Functions and may save you time.
The beta inclusion of Java joins Azure Functions' existing support of JavaScript, C#, F#, Python, PHP, Bash, Batch, and PowerShell to the Azure Function App Serverless model.
The following are useful resources to get started.
Everything listed here will install cross platform – Windows, Linux and MacOS and is free of charge.
You need to add the following Environment Variables to your system
JAVA_HOME that points to your Zulu 8.0 installation
Update your Path variable to include the directory of your Apache Maven installation eg C:\Software\apache-maven-3.5.0\bin
On Windows press Start then type Environment and run "Edit System Environment Variables
On Linux, edit the /etc/environment file, update PATH and add JAVA_HOME variable and reboot.
Run the "mvn azure-functions:add" command from your functions directory. |
|
Select the trigger type. In this case 2 for a Storage Queue Trigger |
|
Open up your Java IDE of choice in this case Visual Studio Code with the Java Expansion Pack Extension. |
|
Add the StorageQueueConnectionString to the local.settings.json |
|
Build the solution with the MVN Package. In this case I ran from the Terminal windows in Visual Studio Code. |
|
Now start up the function locally by running mvn azure-functions:run |
|
Follow notes in the Create your first function with Java and Maven (Preview) to debug from Visual Studio Code. You can step through your Java code, inspect the state of variables etc.
Follow notes in the Create your first function with Java and Maven (Preview)
But in summary
Build Maven Package |
mvn package |
Run maven Function App |
mvn azure-functions:run |
Package ready for deployment to Azure |
mvn azure-functions:package |
Deploy Package to Azure |
az login mvn azure-functions:deploy |
Add new Azure Function App Trigger |
mvn azure-functions:add
|
Please sign in to use this experience.
Sign in