0
0
Azurecloud~5 mins

Function pricing (consumption vs premium) in Azure - CLI Comparison

Choose your learning style9 modes available
Introduction
Azure Functions lets you run small pieces of code without managing servers. You can choose how you pay: pay only when your code runs (consumption) or pay for reserved resources with extra features (premium). This helps control costs and performance.
When you want to pay only for the exact time your code runs to save money on small or infrequent tasks.
When your function needs to start instantly without delay, even after being idle for a while.
When your function requires more memory or CPU than the basic plan offers.
When you want to connect your function to a virtual network for security.
When you need to run your function continuously without scaling down to zero.
Commands
Create a Premium plan named myPremiumPlan in the eastus region with one worker. This plan reserves resources and supports premium features.
Terminal
az functionapp plan create --name myPremiumPlan --resource-group exampleResourceGroup --location eastus --number-of-workers 1 --sku EP1
Expected OutputExpected
{ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/exampleResourceGroup/providers/Microsoft.Web/serverfarms/myPremiumPlan", "location": "eastus", "name": "myPremiumPlan", "sku": { "capacity": 1, "family": "EP", "name": "EP1", "size": "EP1", "tier": "Premium" }, "type": "Microsoft.Web/serverfarms" }
--sku EP1 - Specifies the Premium plan SKU
--number-of-workers 1 - Sets the number of reserved workers
Create a function app named myPremiumFunction using the Premium plan and a storage account. This deploys your function with premium pricing.
Terminal
az functionapp create --name myPremiumFunction --storage-account mystorageaccount --plan myPremiumPlan --resource-group exampleResourceGroup --runtime dotnet
Expected OutputExpected
{ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/exampleResourceGroup/providers/Microsoft.Web/sites/myPremiumFunction", "name": "myPremiumFunction", "resourceGroup": "exampleResourceGroup", "type": "Microsoft.Web/sites" }
--plan myPremiumPlan - Associates the function app with the Premium plan
--runtime dotnet - Sets the runtime stack for the function app
Create a function app named myConsumptionFunction without specifying a plan. This uses the Consumption plan, which bills only when functions run.
Terminal
az functionapp create --name myConsumptionFunction --storage-account mystorageaccount --resource-group exampleResourceGroup --runtime dotnet
Expected OutputExpected
{ "id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/exampleResourceGroup/providers/Microsoft.Web/sites/myConsumptionFunction", "name": "myConsumptionFunction", "resourceGroup": "exampleResourceGroup", "type": "Microsoft.Web/sites" }
--runtime dotnet - Sets the runtime stack for the function app
Check which plan the myPremiumFunction app is using to confirm it is on the Premium plan.
Terminal
az functionapp show --name myPremiumFunction --resource-group exampleResourceGroup --query serverFarmId
Expected OutputExpected
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/exampleResourceGroup/providers/Microsoft.Web/serverfarms/myPremiumPlan"
--query serverFarmId - Filters output to show only the plan ID
Check which plan the myConsumptionFunction app is using to confirm it is on the Consumption plan (usually a dynamic plan).
Terminal
az functionapp show --name myConsumptionFunction --resource-group exampleResourceGroup --query serverFarmId
Expected OutputExpected
"/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/exampleResourceGroup/providers/Microsoft.Web/serverfarms/ConsumptionPlan"
--query serverFarmId - Filters output to show only the plan ID
Key Concept

If you remember nothing else from this pattern, remember: Consumption plan charges only when your code runs, while Premium plan reserves resources for faster and more powerful execution.

Common Mistakes
Creating a function app without specifying a plan when premium features are needed.
The function app defaults to Consumption plan and misses premium features like VNET integration or always-on.
Always create or assign a Premium plan before creating the function app if premium features are required.
Using the Premium plan but setting number-of-workers to zero or not specifying it.
This can cause deployment failure or no reserved resources, defeating the purpose of the Premium plan.
Specify at least one worker when creating the Premium plan to reserve resources.
Summary
Create a Premium plan with reserved workers for advanced features and performance.
Create function apps either on Premium plan for reserved resources or without a plan for Consumption pricing.
Verify the plan assignment using az functionapp show to confirm pricing and features.