Skip to content

Commit 86f79d9

Browse files
committed
final Flex updates
1 parent 6d5873d commit 86f79d9

File tree

1 file changed

+107
-32
lines changed

1 file changed

+107
-32
lines changed

articles/azure-functions/functions-create-first-function-bicep.md

Lines changed: 107 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
---
22
title: Create your function app resources in Azure using Bicep
33
description: Create and deploy to Azure a simple HTTP triggered serverless function using Bicep.
4-
author: mijacobs
5-
ms.author: mijacobs
6-
ms.date: 06/12/2022
4+
author: ggailey777
5+
ms.author: glenga
6+
ms.date: 03/11/2025
77
ms.topic: quickstart
88
ms.service: azure-functions
9+
zone_pivot_groups: programming-languages-set-functions
910
ms.custom: subject-armqs, mode-arm, devx-track-bicep
1011
---
1112

1213
# Quickstart: Create and deploy Azure Functions resources using Bicep
1314

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.
1516

1617
Completing this quickstart incurs a small cost of a few USD cents or less in your Azure account.
1718

1819
[!INCLUDE [About Bicep](~/reusable-content/ce-skilling/azure/includes/resource-manager-quickstart-bicep-introduction.md)]
1920

20-
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.
2122

2223
## Prerequisites
2324

@@ -27,56 +28,111 @@ Before you begin, you must have an Azure account with an active subscription. [C
2728

2829
## Review the Bicep file
2930

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/).
3132

32-
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.web/function-app-create-dynamic/main.bicep":::
33+
:::code language="bicep" source="~/quickstart-templates/quickstarts/microsoft.web/function-app-flex-managed-identities/main.bicep":::
3334

34-
The following four Azure resources are created by this Bicep file:
35+
You use this file to create these Azure resources:
3536

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.
3639
+ [**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.
3841
+ [**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.
4042

41-
[!INCLUDE [functions-storage-access-note](../../includes/functions-storage-access-note.md)]
43+
44+
Deployment considerations:
45+
46+
+ 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.
4248

4349
## Deploy the Bicep file
4450

4551
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.
4752

48-
# [CLI](#tab/CLI)
53+
1. Deploy the Bicep file using either Azure CLI or Azure PowerShell.
4954

55+
### [CLI](#tab/CLI)
56+
::: zone pivot="programming-language-csharp"
5057
```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
5360
```
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
84+
```
85+
::: zone-end
86+
### [PowerShell](#tab/PowerShell)
5487
55-
# [PowerShell](#tab/PowerShell)
56-
88+
::: zone pivot="programming-language-csharp"
5789
```azurepowershell
58-
New-AzResourceGroup -Name exampleRG -Location eastus
59-
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -appInsightsLocation "<app-location>"
90+
New-AzResourceGroup -Name exampleRG -Location <SUPPORTED_REGION>
91+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -functionAppRuntime "dotnet-isolated" -functionAppRuntimeVersion "8.0"
6092
```
93+
::: zone-end
94+
::: zone pivot="programming-language-java"
95+
```azurepowershell
96+
New-AzResourceGroup -Name exampleRG -Location <SUPPORTED_REGION>
97+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -functionAppRuntime "java" -functionAppRuntimeVersion "17"
98+
```
99+
::: zone-end
100+
::: zone pivot="programming-language-javascript,programming-language-typescript"
101+
```azurepowershell
102+
New-AzResourceGroup -Name exampleRG -Location <SUPPORTED_REGION>
103+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -functionAppRuntime "node" -functionAppRuntimeVersion "20"
104+
```
105+
::: zone-end
106+
::: zone pivot="programming-language-python"
107+
```azurepowershell
108+
New-AzResourceGroup -Name exampleRG -Location <SUPPORTED_REGION>
109+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -functionAppRuntime "python" -functionAppRuntimeVersion "3.11"
110+
```
111+
::: zone-end
112+
::: zone pivot="programming-language-powershell"
113+
```azurepowershell
114+
New-AzResourceGroup -Name exampleRG -Location <SUPPORTED_REGION>
115+
New-AzResourceGroupDeployment -ResourceGroupName exampleRG -TemplateFile ./main.bicep -functionAppRuntime "powershell" -functionAppRuntimeVersion "7.4"
116+
```
117+
::: zone-end
61118
62119
---
63120
64-
> [!NOTE]
65-
> 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).
66122
67123
When the deployment finishes, you should see a message indicating the deployment succeeded.
68124
69125
## Validate the deployment
70126
71127
Use Azure CLI or Azure PowerShell to validate the deployment.
72128
73-
# [CLI](#tab/CLI)
129+
### [CLI](#tab/CLI)
74130
75131
```azurecli-interactive
76132
az resource list --resource-group exampleRG
77133
```
78134

79-
# [PowerShell](#tab/PowerShell)
135+
### [PowerShell](#tab/PowerShell)
80136

81137
```azurepowershell-interactive
82138
Get-AzResource -ResourceGroupName exampleRG
@@ -88,28 +144,47 @@ Get-AzResource -ResourceGroupName exampleRG
88144

89145
## Clean up resources
90146

91-
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.
94148

95-
# [CLI](#tab/CLI)
149+
### [CLI](#tab/CLI)
96150

97151
```azurecli-interactive
98152
az group delete --name exampleRG
99153
```
100154

101-
# [PowerShell](#tab/PowerShell)
155+
### [PowerShell](#tab/PowerShell)
102156

103157
```azurepowershell-interactive
104158
Remove-AzResourceGroup -Name exampleRG
105159
```
106160

107161
---
108162

163+
You can also remove resources by using the [Azure portal](https://portal.azure.com).
164+
109165
## Next steps
110166

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)
174+
1. [Verify locally](./functions-run-local.md#run-a-local-function)
175+
1. [Publish to Azure](./functions-run-local.md#publish-to-azure)
176+
177+
### [Visual Studio Code](#tab/vs-code)
178+
179+
1. [Create the local code project](./functions-develop-vs-code.md#create-an-azure-functions-project)
180+
1. [Verify locally](./functions-develop-vs-code.md#run-functions-locally)
181+
1. [Publish to Azure](./functions-develop-vs-code.md#deploy-project-files)
182+
183+
### [Visual Studio](#tab/vs)
184+
185+
1. [Create the local code project](./functions-develop-vs.md#create-an-azure-functions-project)
186+
1. [Verify locally](./functions-develop-vs.md#run-functions-locally)
187+
1. [Publish to Azure](./functions-develop-vs.md#publish-to-azure)
188+
189+
---
112190

113-
* [Visual Studio Code](functions-develop-vs-code.md#republish-project-files)
114-
* [Visual Studio](functions-develop-vs.md#publish-to-azure)
115-
* [Azure Functions Core Tools](functions-run-local.md#publish)

0 commit comments

Comments
 (0)