Share via

I am deploying Function app using terraform and have been facing seviceUnavailable error for host runtime

Abhishek S Thakur 0 Reputation points
2026-01-29T08:31:01.3033333+00:00

This is the code snippet
I am sending the runtime stack and its version using variables.tf

resource "azurerm_linux_function_app" "function_linux" {
  count                      = var.os_type == "Linux" ? 1 : 0
  name                       = pcsfunvtionapp
  location                   = eastus
  resource_group_name        = RGFunctions

  identity {
    type = "SystemAssigned"
  }

  site_config {
  always_on = true
  #linux_fx_version = var.worker_runtime 
  }

  app_settings = {
    "FUNCTIONS_WORKER_RUNTIME"    = lower(var.worker_runtime) # e.g. "python"
    "Version"                     = var.runtime_version # e.g. "3.13"
    "WEBSITE_VNET_ROUTE_ALL"      = "1"
  }

  tags ={
}
}
Azure App Service
Azure App Service

Azure App Service is a service used to create and deploy scalable, mission-critical web apps.

0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-01-29T08:31:12.4366667+00:00

    The serviceUnavailable error for the host runtime in your Azure Function App deployment using Terraform can be caused by several factors. Here are some troubleshooting steps you can take:

    1. Check Runtime Stack and Version: Ensure that the FUNCTIONS_WORKER_RUNTIME and Version settings in your app_settings are correctly set. For example, if you're using Python, make sure that the var.worker_runtime is set to "python" and that var.runtime_version is set to a valid version like "3.8" or similar.
    2. Container Issues: If your function app is running in a Linux container, ensure that the container image is available and can start successfully. You can check the Kudu logs for any errors related to the container startup.
    3. Resource Availability: Ensure that the Azure region (in this case, eastus) has sufficient resources available for your function app. Sometimes, resource constraints can lead to service unavailability.
    4. Always On Setting: Since you have always_on set to true, ensure that your app service plan supports this feature. The always_on setting is only available for Basic, Standard, and Premium tiers.
    5. Networking Issues: If your function app is configured to use a Virtual Network (VNET), ensure that the VNET configuration is correct and that the app can access necessary resources.
    6. Check Azure Status: Sometimes, Azure services may experience outages. Check the Azure status page to see if there are any ongoing issues in your region.

    By reviewing these areas, you should be able to identify and resolve the serviceUnavailable error for your Azure Function App.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.