| title | description | services | author | ms.service | ms.topic | ms.date | ms.author | zone_pivot_groups |
|---|---|---|---|---|---|---|---|---|
Create an Azure Functions app with auto scaling rules on Azure Container Apps |
Learn to create an Azure Functions app preconfigured with auto scaling rules in Azure Container Apps. |
container-apps |
craigshoemaker |
azure-container-apps |
how-to |
01/12/2026 |
cshoe |
azure-cli-or-portal |
This article shows you how to create an Azure Functions app in Azure Container Apps, complete with preconfigured autoscaling rules.
:::zone pivot="azure-portal"
| Resource | Description |
|---|---|
| Azure account | An Azure account with an active subscription. If you don't have one, you can create one for free. |
| Azure Storage account | A blob storage account to store state for your Azure Functions. |
| Azure Application Insights | An instance of Azure Application Insights to collect data about your container app. |
The following steps show you how to use a sample container image to create your container app. If you want to use this procedure with a custom container image, see Create your first function app in Azure Container Apps.
-
Go to the Azure portal and search for Container Apps in the search bar.
-
Select Container Apps.
-
Select Create.
-
Select Container App.
-
In the Basics section, enter the following values.
Under Project details:
Property Value Subscription Select your Azure subscription. Resource group Select Create new resource group, name it my-aca-functions-group, and select OK. Container app name Enter my-aca-functions-app. -
Next to Optimize for Azure Functions, check the checkbox.
:::image type="content" source="media/functions-overview/functions-create-container-app.png" alt-text="Screenshot of the Azure portal when you create a container app preconfigured for Azure Functions.":::
-
Under Container Apps environment, enter:
Property Value Region Select a region closest to you. Container Apps environment Select Create new environment. -
In the environment setup window, enter:
Property Value Environment name Enter my-aca-functions-environment Zone redundancy Select Disabled. -
Select Create to save your values.
-
Select Next: Container to switch to the Container section.
-
Next to Use quickstart image, leave this box unchecked.
-
Under the Container details section, enter the following values.
Property Value Name This box is prefilled with your selection in the previous section. Image source Select Docker Hub or other registries Subscription Select your subscription. Image type Select Public. Registry login server Enter mcr.microsoft.com Image and tag Enter k8se/quickstart-functions:latest -
Under Environment variables, enter values for the following variables:
AzureWebJobsStorageAPPINSIGHTS_INSTRUMENTATIONKEYorAPPLICATIONINSIGHTS_CONNECTION_STRING
Enter either managed identity or connection string values for these variables. Use managed identity.
The
AzureWebJobsStoragevariable is a required Azure Storage account connection string for Azure Functions. This storage account stores function execution logs, manages triggers and bindings, and maintains state for durable functions.Application Insights is a monitoring and diagnostic service that provides insights into the performance and usage of your Azure Functions. This monitoring helps you track request rates, response times, failure rates, and other metrics.
-
Select Next > Ingress to switch to the Ingress section and enter the following values.
Property Value Ingress Select the Enabled checkbox to enable ingress. Ingress traffic Select Accepting traffic from anywhere. Ingress type Select HTTP. Target port Enter 80. -
Select Review + Create.
-
Select Create.
-
Once the deployment is complete, select Go to resource.
-
From the Overview page, select the link next to Application URL to open the application in a new browser tab.
-
Append
/api/HttpExampleto the end of the URL.A message stating "HTTP trigger function processed a request" is returned in the browser.
:::zone-end
:::zone pivot="azure-cli"
- An Azure account with an active subscription.
- If you don't have an Azure account, you can create one for free.
- The Azure CLI installed.
To sign in to Azure from the CLI, run the following command and follow the prompts to complete the authentication process.
-
Sign in to Azure.
az login -
To ensure you're running the latest version of the CLI, run the upgrade command.
az upgrade -
Install or update the Azure Container Apps extension for the CLI.
If you receive errors about missing parameters when you run
az containerappcommands in Azure CLI or cmdlets from theAz.Appmodule in PowerShell, make sure you have the latest version of the Azure Container Apps extension installed.az extension add --name containerapp --allow-preview true --upgradeNow that the current extension or module is installed, register the
Microsoft.AppandMicrosoft.OperationalInsightsnamespaces.az provider register --namespace Microsoft.Appaz provider register --namespace Microsoft.OperationalInsights -
Create environment variables.
RESOURCE_GROUP_NAME="my-aca-functions-group" CONTAINER_APP_NAME="my-aca-functions-app" ENVIRONMENT_NAME="my-aca-functions-environment" LOCATION="westus" STORAGE_ACCOUNT_NAME="storage-account-name" STORAGE_ACCOUNT_SKU="storage-account-sku" APPLICATION_INSIGHTS_NAME="application-insights-name"
-
Create a resource group.
az group create \ --name $RESOURCE_GROUP_NAME \ --location $LOCATION \ --output none -
Create the Container Apps environment.
az containerapp env create \ --name $ENVIRONMENT_NAME \ --resource-group $RESOURCE_GROUP_NAME \ --location $LOCATION \ --output none -
Create the Storage Account
az storage account create \ --name $STORAGE_ACCOUNT_NAME \ --resource-group $RESOURCE_GROUP \ --location $LOCATION \ --sku $STORAGE_ACCOUNT_SKU -
Acquire Storage Account Connection String
$STORAGE_ACCOUNT_CONNECTION_STRING = az storage account show-connection-string \ --name $STORAGE_ACCOUNT_NAME \ --resource-group $RESOURCE_GROUP \ --query connectionString \ --output tsv -
Create Azure Applications Insights
az monitor app-insights component create \ --app $APPLICATION_INSIGHTS_NAME \ --location $LOCATION \ --resource-group $RESOURCE_GROUP \ --application-type web -
Acquire application Insights Connection string
$APPLICATION_INSIGHTS_CONNECTION_STRING = az monitor app-insights component show \ --app $APPLICATION_INSIGHTS_NAME \ --resource-group $RESOURCE_GROUP \ --query connectionString \ --output tsv -
Create an Azure Functions container app.
az containerapp create \ --resource-group $RESOURCE_GROUP_NAME \ --name $CONTAINER_APP_NAME \ --environment $ENVIRONMENT_NAME \ --image mcr.microsoft.com/azure-functions/dotnet8-quickstart-demo:1.0 \ --ingress external \ --target-port 80 \ --kind functionapp \ --query properties.outputs.fqdnThis command returns the URL of your Functions app. Copy this URL and paste it into a web browser.
-
Create an Azure Functions container app with
--revisions-mode multiplefor multirevision scenarioaz containerapp create \ --name $CONTAINERAPP_NAME \ --resource-group $RESOURCE_GROUP \ --environment $CONTAINERAPPS_ENVIRONMENT \ --image mcr.microsoft.com/azure-functions/dotnet8-quickstart-demo:1.0 \ --target-port 80 \ --ingress external \ --kind functionapp \ --workload-profile-name $WORKLOAD_PROFILE_NAME \ --env-vars AzureWebJobsStorage="$STORAGE_ACCOUNT_CONNECTION_STRING" APPLICATIONINSIGHTS_CONNECTION_STRING="$APPLICATION_INSIGHTS_CONNECTION_STRING" -
For multirevision scenario, upgrade the containerapp and split traffic
az containerapp update \ --resource-group $RESOURCE_GROUP \ --name $CONTAINERAPP_NAME \ --image mcr.microsoft.com/azure-functions/dotnet8-quickstart-demo:latest az containerapp ingress traffic set -resource-group \ --name $CONTAINERAPP_NAME \ --resource-group $RESOURCE_GROUP \ --revision-weight {revision1_name}=50 \ --revision-weight {revision2_name}=50 -
Append
/api/HttpExampleto the end of the URL.A message stating "HTTP trigger function processed a request" is returned in the browser.
:::zone-end