You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-functions/functions-deploy-container-apps.md
+10-62Lines changed: 10 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,19 +24,12 @@ Before you can deploy your container to Azure, you need to create three resource
24
24
* A [resource group](../azure-resource-manager/management/overview.md), which is a logical container for related resources.
25
25
* A [Storage account](../storage/common/storage-account-create.md), which is used to maintain state and other information about your functions.
26
26
* An Azure Container Apps environment with a Log Analytics workspace.
27
-
* A managed identity that enables your function app to securely connectto the Azure Container Registry instance using Microsoft Entra authentication, which can be one of these to kinds identity:
27
+
* A user-assigned managed identity that enables your function app to securely connect, using Microsoft Entra authentication, to both the Azure Storage account and to the Azure Container Registry instance, when deploying from a container registry instance. While you can use the system-assigned managed identity that belongs to only your app, you can have more than one user-assigned managed identity assigned to your app. This is the recommended type of identity for this scenario.
28
28
29
-
### [User-assigned](#tab/user-assigned)
30
-
An independent Azure resource assigned to your app that is used for role-based authorization. You can have more than one user-assigned managed identity assigned to your app. This is the recommended type of identity for this scenario.
29
+
>[!NOTE]
30
+
>Docker Hub doesn't support managed identities.
31
31
32
-
### [System-assigned](#tab/system-assigned)
33
-
A managed identity that belongs to only your app. There is only one system-assigned managed identity for a given app.
34
-
35
-
---
36
-
37
-
Docker Hub doesn't support managed identities.
38
-
39
-
Use the following commands to create these items.
32
+
Use these commands to create your required Azure resources:
40
33
41
34
1. If you haven't done so already, sign in to Azure.
42
35
@@ -85,31 +78,24 @@ Use the following commands to create these items.
85
78
86
79
In the previous example, replace `<STORAGE_NAME>` with a name that is appropriate to you and unique in Azure Storage. Storage names must contain 3 to 24 characters numbers and lowercase letters only. `Standard_LRS` specifies a general-purpose account [supported by Functions](storage-considerations.md#storage-account-requirements).
87
80
88
-
1. Create a managed identity and grant it pull permissions in your registry instance. _This step only applies when using Azure Container Registry._
81
+
1. Create a managed identity and grant it access to your storage account and pull permissions in your registry instance.
89
82
90
-
### [User-assigned](#tab/user-assigned)
91
83
```azurecli
92
84
ACR_ID=$(az acr show --name <REGISTRY_NAME> --query id --output tsv)
az role assignment create --assignee $UAMI_ID --role acrpull --scope $ACR_ID
95
88
```
96
89
97
90
The [`az identity create`](/cli/azure/identity#az-identity-create) command creates a user-assigned managed identity and the [`az role assignment create`](/cli/azure/role/assignment#az-role-assignment-create) adds your identity to the `acrpull` role in your registry. Replace `<REGISTRY_NAME>` and `<USER_IDENTITY_NAME>` with the name your existing container registry and name for your managed identity, respectively. The managed identity can now be used by an app to access Azure Container Registry without using shared secrets.
98
-
99
-
### [System-assigned](#tab/system-assigned)
100
-
101
-
Proceed to the next section to create a system-assigned managed identity automatically when you create your app.
102
-
103
-
---
104
-
105
91
106
92
## Create and configure a function app on Azure with the image
107
93
108
94
A function app on Azure manages the execution of your functions in your Azure Container Apps environment. In this section, you use the Azure resources from the previous section to create a function app from an image in a container registry in a Container Apps environment. You also configure the new environment with a connection string to the required Azure Storage account.
109
95
110
96
Use the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command to create a function app in the new managed environment backed by Azure Container Apps. In [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create), the `--environment` parameter specifies the Container Apps environment.
> To make sure that your function app uses a managed identity-based connection to your registry instance, don't set the `--image` parameter in `az functionapp create`. When you set `--image` to the fully-qualified name of your image in the repository, shared secret credentials are obtained from your registry and stored in app settings.
@@ -136,50 +122,12 @@ In addition to the required site settings, the [`az resource patch`](/cli/azure/
136
122
137
123
In this example, replace `<APP_NAME>`, `<REGISTRY_NAME>`, and `<USER_IDENTITY_NAME>` with the names of your function app, container registry, and identity, respectively.
> To make sure that your function app uses a managed identity-based connection to your registry instance, don't set the `--image` parameter in `az functionapp create`. When you set `--image` to the fully-qualified name of your image in the repository, shared secret credentials are obtained from your registry and stored in app settings.
143
-
144
-
First use the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command to create a function app using the default image and with a system-assigned managed identity enabled.
In [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create), using `--assign-identity` enables a system-assigned managed identity for your new app. Because you didn't set the `--image` parameter in `az functionapp create`, the application is created using a placeholder image.
151
-
152
-
In this example, replace `<APP_NAME>` and `<STORAGE_NAME>` with a name for your new function app.
153
-
154
-
Finally, you must update the [`linuxFxVersion`](./functions-app-settings.md#linuxfxversion) site setting to the fully-qualified name of your image in the repository. You must also update the [`acrUseManagedIdentityCreds`](./functions-app-settings.md#acrusemanagedidentitycreds) site settings so that managed identities are used when obtaining the image from the registry.
155
-
156
-
```azurecli
157
-
UAMI_RESOURCE_ID=$(az identity show --name <USER_IDENTITY_NAME> --resource-group AzureFunctionsContainers-rg --query id -o tsv)
In addition to the required site settings, the [`az resource patch`](/cli/azure/resource#az-resource-patch) command also updates the [`DOCKER_REGISTRY_SERVER_URL`](./functions-app-settings.md#docker_registry_server_url) app setting to the URL of your registry server.
162
-
163
-
In this example, replace `<APP_NAME>`, `<REGISTRY_NAME>`, and `<USER_IDENTITY_NAME>` with the names of your function app, container registry, and identity, respectively.
164
-
165
-
### [Docker Hub](#tab/docker/user-assigned)
166
-
167
-
First use the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command to create a function app using the image from your container repository.
In the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command, the `--environment` parameter specifies the Container Apps environment and the `--image` parameter specifies the image to use for the function app. In this example, replace `<STORAGE_NAME>` with the name you used in the previous section for the storage account. Also, replace `<APP_NAME>` with a globally unique name appropriate to you and `<DOCKER_ID>` with your public Docker Hub account ID.
174
-
175
-
If you're using a private registry, you need to include the fully qualified domain name of your registry instead of just the Docker ID for `<DOCKER_ID>`, along with the `--registry-username` and `--registry-password` credential required to access the registry.
176
-
177
-
### [Docker Hub](#tab/docker/system-assigned)
125
+
### [Docker Hub](#tab/docker)
178
126
179
-
First use the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command to create a function app using the image from your container repository.
127
+
First you must get fully-qualified ID value of your user-assigned managed identity, and then use the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command to create a function app using the default image and with this identity assigned to it.
In the [`az functionapp create`](/cli/azure/functionapp#az-functionapp-create) command, the `--environment` parameter specifies the Container Apps environment and the `--image` parameter specifies the image to use for the function app. In this example, replace `<STORAGE_NAME>` with the name you used in the previous section for the storage account. Also, replace `<APP_NAME>` with a globally unique name appropriate to you and `<DOCKER_ID>` with your public Docker Hub account ID.
0 commit comments