Azure Functions Example

Pre Requisites

Step 1:

Go to project directory -> example -> azure-functions

After installing the pre requisities, you need to create a project in the above mentioned directory from Azure Fucntions Core Tools in order to create a function.

func init . --docker

Functions-Step1

With the above command, you will be creating a functions project. Then at the end we will be providing a “–docker” in order to create a Dockerfile along with the initial stage.

If Dockerfile is not created, create the file as below.

DockerFile

FROM microsoft/azure-functions-runtime:v2.0.0-beta1
ENV AzureWebJobsScriptRoot=/home/site/wwwroot
COPY . /home/site/wwwroot

Step 2:

Create a function type accordingly with the following command.

func new

Functions-Step2

Step 3:

Go to the created function. For me it’s HttpTriggerJS folder -> function.json Change the authLevel to “anonymous”.

Functions-Step3

Step 4:

Pull the docker image

docker pull microsoft/azure-functions-node8

Step 5:

Go to project terminal and init the file

Expected Result

Functions-Result1

Functions-Result2

Functions-Result3