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
# Quickstart: Create and deploy Azure Functions resources using Bicep
13
14
14
-
In this article, you use Azure Functions with Bicep to create a function app and related resources in Azure. The function app provides an execution context for your function code executions.
15
+
In this article, you use Bicep to create a function app in a Flex Consumption plan in Azure, along with its required Azure resources. The function app provides a serverless execution context for your function code executions. The app uses Microsoft Entra ID with managed identities to connect to other Azure resources.
15
16
16
17
Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
After you create the function app, you can deploy Azure Functions project code to that app.
21
+
After you create the function app, you can deploy your Azure Functions project code to that app. A final code deployment step is outside the scope of this quickstart article.
21
22
22
23
## Prerequisites
23
24
@@ -27,56 +28,111 @@ Before you begin, you must have an Azure account with an active subscription. [C
27
28
28
29
## Review the Bicep file
29
30
30
-
The Bicep file used in this quickstart is from [Azure Quickstart Templates](https://azure.microsoft.com/resources/templates/function-app-create-dynamic/).
31
+
The Bicep file used in this quickstart is from an [Azure Quickstart Template](https://azure.microsoft.com/resources/templates/function-app-create-dynamic/).
The following four Azure resources are created by this Bicep file:
35
+
You use this file to create these Azure resources:
35
36
37
+
+[**microsoft.Insights/components**](/azure/templates/microsoft.insights/components): creates an Application Insights instance for monitoring your app.
38
+
+[**Microsoft.OperationalInsights/workspaces**](/azure/templates/microsoft.operationalinsights/workspaces): creates a workspace required by Application Insights.
36
39
+[**Microsoft.Storage/storageAccounts**](/azure/templates/microsoft.storage/storageaccounts): create an Azure Storage account, which is required by Functions.
37
-
+[**Microsoft.Web/serverfarms**](/azure/templates/microsoft.web/serverfarms): create a serverless Consumption hosting plan for the function app.
40
+
+[**Microsoft.Web/serverfarms**](/azure/templates/microsoft.web/serverfarms): create a serverless Flex Consumption hosting plan for the function app.
38
41
+[**Microsoft.Web/sites**](/azure/templates/microsoft.web/sites): create a function app.
39
-
+[**microsoft.insights/components**](/azure/templates/microsoft.insights/components): create an Application Insights instance for monitoring.
+ The storage account is used to store important app data, including the application code deployment package. This deployment creates a storage account that is accessed using Microsoft Entra ID authentication and managed identities. Identity access is granted on a least-permissions basis.
47
+
+ The Bicep file defaults to creating a C# app that uses .NET 8 in an isolated process. For other languages, use the `functionAppRuntime` and `functionAppRuntimeVersion` parameters to specify the specific language and version on which to run your app. Make sure to select your programming language at the [top](#top) of the article.
42
48
43
49
## Deploy the Bicep file
44
50
45
51
1. Save the Bicep file as **main.bicep** to your local computer.
46
-
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
47
52
48
-
# [CLI](#tab/CLI)
53
+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
49
54
55
+
### [CLI](#tab/CLI)
56
+
::: zone pivot="programming-language-csharp"
50
57
```azurecli
51
-
az group create --name exampleRG --location eastus
52
-
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters appInsightsLocation=<app-location>
58
+
az group create --name exampleRG --location <SUPPORTED_REGION>
59
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters functionAppRuntime=dotnet-isolated functionAppRuntimeVersion=8.0
53
60
```
61
+
::: zone-end
62
+
::: zone pivot="programming-language-java"
63
+
```azurecli
64
+
az group create --name exampleRG --location <SUPPORTED_REGION>
65
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters functionAppRuntime=java functionAppRuntimeVersion=17
66
+
```
67
+
::: zone-end
68
+
::: zone pivot="programming-language-javascript,programming-language-typescript"
69
+
```azurecli
70
+
az group create --name exampleRG --location <SUPPORTED_REGION>
71
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters functionAppRuntime=node functionAppRuntimeVersion=20
72
+
```
73
+
::: zone-end
74
+
::: zone pivot="programming-language-python"
75
+
```azurecli
76
+
az group create --name exampleRG --location <SUPPORTED_REGION>
77
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters functionAppRuntime=python functionAppRuntimeVersion=3.11
78
+
```
79
+
::: zone-end
80
+
::: zone pivot="programming-language-powershell"
81
+
```azurecli
82
+
az group create --name exampleRG --location <SUPPORTED_REGION>
83
+
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters functionAppRuntime=powerShell functionAppRuntimeVersion=7.4
> Replace **\<app-location\>** with the region for Application Insights, which is usually the same as the resource group.
121
+
In this example, replace `<SUPPORTED_REGION>` with a region that [supports the Flex Consumption plan](./flex-consumption-how-to.md#view-currently-supported-regions).
66
122
67
123
When the deployment finishes, you should see a message indicating the deployment succeeded.
68
124
69
125
## Validate the deployment
70
126
71
127
Use Azure CLI or Azure PowerShell to validate the deployment.
If you continue to the next step and add an Azure Storage queue output binding, keep all your resources in place as you'll build on what you've already done.
92
-
93
-
Otherwise, if you no longer need the resources, use Azure CLI, PowerShell, or Azure portal to delete the resource group and its resources.
147
+
Now that you have deployed a function app and related resources to Azure, can continue to the next step of publishing project code to your app. Otherwise, use these commands to delete the resources, when you no longer need them.
94
148
95
-
# [CLI](#tab/CLI)
149
+
###[CLI](#tab/CLI)
96
150
97
151
```azurecli-interactive
98
152
az group delete --name exampleRG
99
153
```
100
154
101
-
# [PowerShell](#tab/PowerShell)
155
+
###[PowerShell](#tab/PowerShell)
102
156
103
157
```azurepowershell-interactive
104
158
Remove-AzResourceGroup -Name exampleRG
105
159
```
106
160
107
161
---
108
162
163
+
You can also remove resources by using the [Azure portal](https://portal.azure.com).
164
+
109
165
## Next steps
110
166
111
-
Now that you've created your function app resources in Azure, you can deploy your code to the existing app by using one of the following tools:
167
+
You can now deploy a code project to the function app resources you created in Azure.
168
+
169
+
You can create, verify, and deploy a code project to your new function app from these local environments:
170
+
171
+
### [Command prompt](#tab/core-tools)
172
+
173
+
1.[Create the local code project](./functions-run-local.md#create-your-local-project)
0 commit comments