Dynatrace-Reinhard-Pilz / function-sample-azure-http-trigger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Azure Functions HTTP triggers sample

Important
For a general information about building and deploying Azure Functions with Spring Cloud Function, consult the Azure Adapter documentation.

Azure Functions may be invoked via HTTP requests to build serverless APIs. Find more about the HTTP triggers.

Usage

Package Staging folder

Use the script below to package your staging folder:

./mvnw clean package

Run Azure Functions locally

Use the script below to run the function locally.

./mvnw azure-functions:run
Note
To run locally on top of Azure Functions, and to deploy to your live Azure environment, you will need Azure Functions Core Tools installed along with the Azure CLI (see here).
Note
Azure Functions Core Tools version 4.0.5030 or newer is required!

For some configuration you would need the Azurite emulator as well.

Deploy Azure Functions to Azure Cloud

Make sure you are logged in your Azure account.

az login

then build and deploy

./mvnw clean package
./mvnw azure-functions:deploy

Debug locally

Run the function in debug mode.

./mvnw azure-functions:run -DenableDebug

Alternatively and the JAVA_OPTS value to your local.settings.json like this:

{
	"IsEncrypted": false,
	"Values": {
		...
		"FUNCTIONS_WORKER_RUNTIME": "java",
		"JAVA_OPTS": "-Djava.net.preferIPv4Stack=true -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=127.0.0.1:5005"
	}
}

For VSCode remote debug use configuration like this:

{
	"version": "0.2.0",
	"configurations": [
		{
			"type": "java",
			"name": "Attach to Remote Program",
			"request": "attach",
			"hostName": "localhost",
			"port": "5005"
		},
	    ...
	]
}

About


Languages

Language:Java 100.0%