AzureAzure App ServiceCompute

azurerm_service_plan cost estimation

A compute plan for web apps, API apps, and function apps. Priced per hour by SKU and number of instances.

An azurerm_service_plan defines the compute, scaling, and feature tier for one or more Azure App Service apps (web apps, function apps, container apps). It's the modern replacement for azurerm_app_service_plan.

Pricing is dominated by the SKU and the number of instances (worker_count). SKUs fall into tiers:

Free (F1) and Shared (D1) tiers are limited and intended for small, non-production workloads. F1 is free.

Basic (B1, B2, B3) gives dedicated compute but limited features. B1 is ~$54/month.

Standard (S1, S2, S3) adds auto-scaling, deployment slots, and custom domains. S1 is ~$73/month.

Premium V2 and Premium V3 (P1v2/v3 through P3v3) add VNet integration, larger compute sizes, and better performance per dollar. P1v3 is ~$152/month.

Isolated V2 (I1v2 through I3v2) runs in an App Service Environment with dedicated infrastructure. Most expensive, starting around $300/month.

Function Apps have an additional tier: Consumption plan (Y1) which is true serverless, billed per execution and GB-second like AWS Lambda. Set os_type = "Linux" and sku_name = "Y1" for consumption.

Premium plans also have a Function App variant (EP1, EP2, EP3) that gives always-on workers with reserved capacity.

c3x reads sku_name and worker_count from the resource. Function consumption plans require usage data via c3x-usage.yml.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "azurerm_service_plan" "main" {
  name                = "production-asp"
  resource_group_name = azurerm_resource_group.main.name
  location            = "eastus"
  os_type             = "Linux"
  sku_name            = "P1v3"
  worker_count        = 2
}

resource "azurerm_linux_web_app" "api" {
  name                = "production-api"
  resource_group_name = azurerm_resource_group.main.name
  location            = "eastus"
  service_plan_id     = azurerm_service_plan.main.id

  site_config {
    application_stack {
      docker_image_name = "myorg/api:v1.2.3"
    }
  }
}

Pricing dimensions

What you actually pay for when you provision azurerm_service_plan.

DimensionUnitWhat's being charged
Plan hoursper instance per hourRate for the SKU. Multiplied by worker_count (number of instances).
$0.208/hour for P1v3 in eastus (≈ $152/month per instance)
Function consumption (Y1)per execution + per GB-secondServerless pricing for function apps. First 1M executions and 400,000 GB-seconds per month free.
Premium V3 sizesper instance per hourP1v3 through P5v3, with prices roughly doubling per size tier.

Optimization tips

Common ways to reduce azurerm_service_plan cost without changing the workload.

Use Premium V3 over Premium V2

More compute per dollar

P1v3 has 2-4x more memory and CPU than P1v2 for similar money. AWS-equivalent reserved-instance behavior: just upgrade to v3 when planning new workloads.

Buy reserved instances for steady-state plans

30-55%

Azure Reserved Instances for App Service give 30-55% discount with 1-year or 3-year commitments. Right for production plans.

Consolidate small apps onto one plan

$30-50/month per consolidated app

An App Service Plan can host multiple apps. Three small apps on three Basic plans cost ~$162/month. One Standard plan hosting all three is $73/month and gives them deployment slots.

Use Function Consumption for unpredictable traffic

Workload-dependent

If your function workload is low or spiky, Consumption (Y1) is right. For predictable >1M req/day traffic, Premium (EP1) can be cheaper than scaled-up consumption.

FAQ

What's the difference between azurerm_service_plan and azurerm_app_service_plan?

azurerm_service_plan is the modern resource. azurerm_app_service_plan is deprecated but still in many existing configurations. They support the same SKUs. c3x estimates both.

Do I pay for app slots separately?

No. Deployment slots are a feature of Standard and higher plans, included in the plan price. The slot doesn't double your cost; it's another deployment endpoint that uses the same compute pool.

How does Function Consumption pricing work in c3x?

For Y1 (Consumption) plans, c3x uses the same model as AWS Lambda: per-execution and per-GB-second. Specify monthly_executions and average_duration_ms on the underlying function in c3x-usage.yml.

What about App Service Environment v3?

ASE v3 hosts Isolated V2 plans (I1v2, I2v2, I3v2) on dedicated infrastructure. The ASE itself has a per-hour stamp fee plus the instance costs. Right for compliance scenarios needing single-tenant compute.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including azurerm_service_plan.