Running Piranha Nano on Azure Functions

Using Custom Handlers

As Piranha Nano has been removed as an offering this content is no longer relevant

How much effort does it take to run a Piranha Nano application as an Azure Function using a Custom Handler?

Follow the steps mentioned below.

  1. Create the Function App on Azure
  2. Install the Piranha CLI
  3. Generate the application
  4. Build the application
  5. Deploy the application

Create the Function App on Azure

To deploy the Piranha Nano application we need an Azure Function App. So we are are going to create the necessary Azure resources first. Please execute the script below. Please make sure to change the values where appropriate.



# Function app and storage account names must be unique.

# Create a Resource group
az group create \
  --name $resourceGroup \
  --location $region

# Create a Storage account
az storage account create \
  --name $storageName \
  --location $region \
  --resource-group $resourceGroup \
  --sku Standard_LRS

# Create a Premium plan
az functionapp plan create \
  --name $premiumplan \
  --resource-group $resourceGroup \
  --location $region \
  --is-linux true \
  --sku EP1

# Create a Function app
az functionapp create \
  --name $functionAppName \
  --storage-account $storageName \
  --plan $$premiumplan \
  --resource-group $resourceGroup \
  --functions-version 3


Install the Piranha CLI

This example uses the Piranha CLI so we need to download it and install it. Go to and download the zip / tar.gz bundle for your OS. Unzip it in a directory of your choice and add the bin directory to your PATH.

Generate the application

The Piranha CLI is capable of generating the project skeleton that you can use to develop a Piranha Nano application. In an empty directory execute the command below:

pi nano generate

Build the application

The skeleton that was generated also generated the Dockerfile that is used by the Piranha CLI to build the file needed for cloud deployment. To build the application execute the following command in the base directory of the generated project:

pi nano cloud build

Deploy the application

To deploy the application use the command line below. Make sure you substitute the <application-name> with the application name you used to create the Azure Function App (which is the value of functionAppName in the bash script).

pi nano cloud deploy --name <application-name>

Open your browser to https://<application-name> and you will see 'Hello World'.

As you can see it is easy to get up and running with Piranha Nano on Azure Functions.


Posted December 13th, 2020