|
| 1 | +--- |
| 2 | +title: Manage Azure Functions on Container Apps using Azure CLI |
| 3 | +description: Learn how to deploy, configure, and manage Azure Functions on Azure Container Apps using the Azure CLI. |
| 4 | +services: container-apps |
| 5 | +author: craigshoemaker |
| 6 | +ms.service: azure-container-apps |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 11/25/2025 |
| 9 | +ms.author: cshoe |
| 10 | +--- |
| 11 | + |
| 12 | +# Manage Azure Functions on Container Apps using Azure CLI |
| 13 | + |
| 14 | +This article shows you how to deploy and manage Azure Functions on Azure Container Apps by using the Azure CLI. You learn how to set up your environment, create the necessary Azure resources, and deploy function apps for managing function operations. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +Before you begin, ensure you have: |
| 19 | + |
| 20 | +- An Azure subscription. If you don't have one, [create a free account](https://azure.microsoft.com/free/). |
| 21 | +- [Azure CLI](/cli/azure/install-azure-cli) version 2.0.70 or later. |
| 22 | +- A [Functions app](functions-usage.md) ready for containerized deployment |
| 23 | + |
| 24 | +## Manage functions |
| 25 | + |
| 26 | +You can manage your deployed functions within Azure Container Apps using the Azure CLI. The following commands help you list, inspect, and interact with the functions running in your containerized environment. |
| 27 | + |
| 28 | +> [!NOTE] |
| 29 | +> When dealing with multirevision scenarios, add the `--revision <REVISION_NAME>` parameter to your command to target a specific revision. |
| 30 | +
|
| 31 | +### List functions |
| 32 | + |
| 33 | +View all functions deployed in your container app: |
| 34 | + |
| 35 | +```azurecli |
| 36 | +# List all functions |
| 37 | +az containerapp function list \ |
| 38 | + --resource-group <RESOURCE_GROUP> \ |
| 39 | + --name <CONTAINER_APP_NAME> |
| 40 | +``` |
| 41 | + |
| 42 | +### Show function details |
| 43 | + |
| 44 | +Get detailed information about a specific function: |
| 45 | + |
| 46 | +```azurecli |
| 47 | +az containerapp function show \ |
| 48 | + --resource-group <RESOURCE_GROUP> \ |
| 49 | + --name <CONTAINER_APP_NAME> \ |
| 50 | + --function-name <FUNCTIONS_APP_NAME> |
| 51 | +``` |
| 52 | + |
| 53 | +## Monitor function invocations |
| 54 | + |
| 55 | +Monitoring your function app is essential for understanding its performance and diagnosing issues. The following commands show you how to retrieve function URLs, trigger invocations, and view detailed telemetry and invocation summaries by using the Azure CLI. |
| 56 | + |
| 57 | +1. To view invocation traces, get detailed traces of function invocations. |
| 58 | + |
| 59 | + ```azurecli |
| 60 | + az containerapp function invocations traces \ |
| 61 | + --name <CONTAINER_APP_NAME> \ |
| 62 | + --resource-group <RESOURCE_GROUP> \ |
| 63 | + --function-name <FUNCTIONS_APP_NAME> \ |
| 64 | + --timespan 5h \ |
| 65 | + --limit 3 |
| 66 | + ``` |
| 67 | +
|
| 68 | +1. View an invocation summary to review successful and failed invocations. |
| 69 | +
|
| 70 | + ```azurecli |
| 71 | + az containerapp function invocations summary \ |
| 72 | + --name <CONTAINER_APP_NAME> \ |
| 73 | + --resource-group <RESOURCE_GROUP> \ |
| 74 | + --function-name <FUNCTIONS_APP_NAME> \ |
| 75 | + --timespan 5h |
| 76 | + ``` |
| 77 | +
|
| 78 | +## Manage function keys |
| 79 | +
|
| 80 | +Azure Functions uses [keys for authentication and authorization](/azure/azure-functions/function-keys-how-to). You can manage the following different types of keys: |
| 81 | +
|
| 82 | +- **Host keys**: Access any function in the app |
| 83 | +- **Master keys**: Provide administrative access |
| 84 | +- **System keys**: Used by Azure services |
| 85 | +- **Function keys**: Access specific functions |
| 86 | +
|
| 87 | +The following commands show you how to manage keys for the host. To run the same command for a specific Functions app, add the `--function-name <FUNCTIONS_APP_NAME>` parameter to your command. |
| 88 | +
|
| 89 | +### List keys |
| 90 | +
|
| 91 | +Use the following commands to list host-level and function-specific keys for your Azure Functions running in Container Apps. |
| 92 | +
|
| 93 | +> [!NOTE] |
| 94 | +> Keep a minimum of one replica running for the following keys management commands to work. |
| 95 | +
|
| 96 | +```azurecli |
| 97 | +az containerapp function keys list \ |
| 98 | + --resource-group <RESOURCE_GROUP> \ |
| 99 | + --name <CONTAINER_APP_NAME> \ |
| 100 | + --key-type hostKey |
| 101 | +``` |
| 102 | + |
| 103 | +### Show a specific key |
| 104 | + |
| 105 | +Show the value of a specific host-level key for your function app with the following command: |
| 106 | + |
| 107 | +```azurecli |
| 108 | +az containerapp function keys show \ |
| 109 | + --resource-group <RESOURCE_GROUP> \ |
| 110 | + --name <CONTAINER_APP_NAME> \ |
| 111 | + --key-name <KEY_NAME> \ |
| 112 | + --key-type hostKey |
| 113 | +``` |
| 114 | + |
| 115 | +### Set a key |
| 116 | + |
| 117 | +Set a specific host-level key for your function app with the following command: |
| 118 | + |
| 119 | +```azurecli |
| 120 | +az containerapp function keys set \ |
| 121 | + --resource-group <RESOURCE_GROUP> \ |
| 122 | + --name <CONTAINER_APP_NAME> \ |
| 123 | + --key-name <KEY_NAME> \ |
| 124 | + --key-value <KEY_VALUE> \ |
| 125 | + --key-type hostKey |
| 126 | +``` |
| 127 | + |
| 128 | +## Next steps |
| 129 | + |
| 130 | +- [Learn about Azure Functions triggers and bindings](../azure-functions/functions-triggers-bindings.md) |
| 131 | +- [Monitor Azure Functions](../azure-functions/functions-monitoring.md) |
| 132 | +- [Scale apps in Azure Container Apps](scale-app.md) |
| 133 | +- [Manage revisions in Azure Container Apps](revisions.md) |
0 commit comments