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
The [az functionapp create](/cli/azure/functionapp#az-functionapp-create) command creates the function app in Azure.
150
147
<!---
@@ -158,28 +155,24 @@ To learn more, see [Azure Functions HTTP triggers and bindings](./functions-bind
158
155
159
156
---
160
157
-->
161
-
In this example, replace `<STORAGE_NAME>` with the name of the account you used in the previous step, replace `<REGION>` with your region, and replace `<APP_NAME>` with a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
158
+
In this example, replace these placholders:
162
159
163
-
This command creates a function app running in your specified language runtime on Linux in the [Flex Consumption Plan](flex-consumption-plan.md), which is free for the amount of usage you incur here. The command also creates an associated Azure Application Insights instance in the same resource group, with which you can monitor your function app and view logs. For more information, see [Monitor Azure Functions](functions-monitoring.md). The instance incurs no costs until you activate it.
160
+
+ `<STORAGE_NAME>`: the name of the account you used in the previous step.
161
+
+ `<REGION>`: your region.
162
+
+ `<APP_NAME>`: a globally unique name appropriate to you. The `<APP_NAME>` is also the default DNS domain for the function app.
163
+
+ `<USER_NAME>`: the name of the user-assigned managed identity.
164
+
+ `<LANGUAGE>`: use `dotnet-isolated`.
165
+
+ `<LANGUAGE_VERSION>`: use `8.0`.
164
166
165
-
## Update application settings
167
+
This command creates a function app running in your specified language runtime on Linux in the [Flex Consumption Plan](flex-consumption-plan.md), which is free for the amount of usage you incur here. The command also creates an associated Azure Application Insights instance in the same resource group, with which you can monitor your function app and view logs. For more information, see [Monitor Azure Functions](functions-monitoring.md). The instance incurs no costs until you activate it.
166
168
167
-
To enable the Functions host to connect to the default storage account using shared secrets, you must replace the `AzureWebJobsStorage` connection string setting with an equivalent setting that uses the user-assigned managed identity to connect to the storage account.
169
+
8. Add your user-assigned managed identity to the [Monitoring Metrics Publisher](../role-based-access-control/built-in-roles/monitor#monitoring-metrics-publisher) role in your Application Insights instance:
168
170
169
-
1. Remove the existing `AzureWebJobsStorage` connection string setting:
The [az role assignment create](/cli/azure/role/assignment#az-role-assignment-create) command adds your user to the role. The resource ID of your Application Insights instance is obtained by using [az monitor app-insights component show](/cli/azure/monitor/app-insights/component#az-monitor-app-insights-component-show).
174
174
175
-
The [az functionapp config appsettings delete](/cli/azure/functionapp/config/appsettings#az-functionapp-config-appsettings-delete) command removes this setting from your app.
176
-
177
-
1. Add equivalent settings, with an `AzureWebJobsStorage__` prefix, that define a user-assigned managed identity connection to the default storage account:
At this point, the Functions host is able to connect to the storage account securely using managed identities. You can now deploy your project code to the Azure resources
The [az group create](/cli/azure/group#az-group-create) command creates a resource group. In the above command, replace `<REGION>` with a region near you that supports the Flex Consumption plan. Use an available region code returned from the [az functionapp list-flexconsumption-locations](/cli/azure/functionapp#az-functionapp-list-flexconsumption-locations) command.
50
52
<!---
@@ -63,9 +65,7 @@ Use the following commands to create these items. Both Azure CLI and PowerShell
This [az storage account create](/cli/azure/storage/account#az-storage-account-create) command creates a storage account.
71
71
<!---
@@ -79,28 +79,17 @@ Use the following commands to create these items. Both Azure CLI and PowerShell
79
79
80
80
---
81
81
-->
82
+
82
83
In this example, replace `<STORAGE_NAME>` with a name that is appropriate to you and unique in Azure Storage. Names must contain three to 24 characters numbers and lowercase letters only. `Standard_LRS` specifies a general-purpose account, which is [supported by Functions](../articles/azure-functions/storage-considerations.md#storage-account-requirements). This new account can only be accessed by using Micrososft Entra-authenticated identities that have been granted permissions to specific resources.
83
84
84
85
1. Create a user-assigned managed identity, then capture and parse the returned JSON properties of the object using `jq`:
If you don't have the `jq` utility in your local Bash shell, it's available in Azure Cloud Shell. The [az identity create](/cli/azure/identity#az-identity-create) command creates a new identity in the resource group named `func-host-storage-user`. The returned `principalId` is used to assign permissions to this new identity in the default storage account by using the [`az role assignment create`](/cli/azure/role/assignment#az-role-assignment-create) command. The [`az storage account show`](/cli/azure/storage/account#az-storage-account-show) command is used to obtain the storage account ID.
97
90
98
91
1. Grant to the new identity the required access in the default storage account by using the built-in `Storage Blob Data Owner` role:
99
92
100
-
```azurecli
101
-
# Get the storage ID and create a role assignment (Storage Blob Data Owner) for the UAMI in storage.
az role assignment create --assignee-object-id $principalId --assignee-principal-type ServicePrincipal --role "Storage Blob Data Owner" --scope $storageId
To enable the Functions host to connect to the default storage account using shared secrets, you must replace the `AzureWebJobsStorage` connection string setting with a complex setting, prefixed with `AzureWebJobsStorage`, that uses the user-assigned managed identity to connect to the storage account.
12
+
13
+
1. Remove the existing `AzureWebJobsStorage` connection string setting:
The [az functionapp config appsettings delete](/cli/azure/functionapp/config/appsettings#az-functionapp-config-appsettings-delete) command removes this setting from your app.
18
+
19
+
1. Add equivalent settings, with an `AzureWebJobsStorage__` prefix, that define a user-assigned managed identity connection to the default storage account:
0 commit comments