Error while loading functions in function app

Samuel Bradshaw 30 Reputation points
2024-04-03T17:16:46.9633333+00:00

I have deployed a containerised function app using the azure-cli command:

az functionapp create \
    --name $function_app_name \
    --resource-group $resource_group \
    --storage-account $storage_account_name \
    --functions-version 4 \
    --consumption-plan-location $location \
    --os-type Linux \
    --runtime python \
    --image $container_registry.azurecr.io/$image_name:latest

Where my custom docker image uses the mcr.microsoft.com/azure-functions/python:4-python3.11 base image.

My docker container works when I run it locally, however, after deploying the app to azure using the above command, I cannot view the function in the Azure portal. All I see is "Error while loading functions Encountered an error (ServiceUnavailable) from host runtime":
User's image

I see a few warnings when I run the above CLI command:

Runtime docker not supported for os linux. Supported runtimes for os linux are: ['dotnet-isolated', 'dotnet-isolated', 'dotnet-isolated', 'dotnet', 'node', 'node', 'node', 'node', 'python', 'python', 'python', 'python', 'python', 'java', 'java', 'java', 'java', 'powershell', 'custom']. Run 'az functionapp list-runtimes' for more details on supported runtimes.

App settings have been redacted. Use `az webapp/logicapp/functionapp config appsettings list` to view.
Although I'm not sure if these are relevant to the issue. If I omit the --os-type and --runtime args it seems to default to windows and dotnet.

Why is my function failing to display in the Azure portal?

I am using azure-cli version 2.58.0.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,929 questions
0 comments No comments
{count} votes

Accepted answer
  1. Silvia Wibowo 6,046 Reputation points Microsoft Employee Volunteer Moderator
    2024-04-04T00:53:22.63+00:00

    Hi @Samuel Bradshaw , I understand that you tried to deploy Azure Functions using docker on Linux OS.

    Deploying your function code to Azure Functions in a container requires Premium plan or Dedicated (App Service) plan hosting.

    More info: Create your first containerized Azure Functions.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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