How to create a Consumption Hosting plan for Function Apps in Azure

Posted by:

|

On:

|

,
Azure Functions img

One of the toughest challenges in cloud computing is keeping costs down. It’s like trying to navigate through a supermarket without picking up any unnecessary snacks – nearly impossible!

Azure Functions provides a serverless approach, enabling you to minimise code writing, infrastructure management, and expenditure. Rather than dealing with server deployment and upkeep, the cloud infrastructure delivers the necessary resources to sustain your applications seamlessly.

Consumption hosting plan is best choice for running a function app in lower cost and easiest way to create it is using ARM template.


1. Go to Azure Portal and click “Create a resource” & search for “Custom Template Deployment” in marketplace.

2. Select “Build your own template in the editor” and paste below ARM template to create a dynamic hosting plan. If you want to name the hosting plan with specific name, please edit the line:14 with required text.

3. Once ARM template is added, click Next and select the required resource group and location where you want the consumption plan to be created.

4. Finally step, click “Review and Create”.

Yay! Dynamic/Consumption Hosting Plan Y1 is created now.

ARM Template Script:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]",
            "metadata": {
                "description": "Location for all resources."
            }
        } 
    },
    "variables": {
        "hostingPlanName": "DynamicConsumptionPlan"
    },
    "resources": [
        {
            "type": "Microsoft.Web/serverfarms",
            "apiVersion": "2021-03-01",
            "name": "[variables('hostingPlanName')]",
            "location": "[parameters('location')]",
            "sku": {
                "name": "Y1",
                "tier": "Dynamic"
            },
            "properties": {}
        }
    ]
}