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-create-first-function-terraform.md
+51-76Lines changed: 51 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,18 @@
2
2
title: 'Quickstart: Create and deploy Azure Functions resources from Terraform'
3
3
description: In this quickstart article, you create a function app in a Flex Consumption plan, along with the resource group, storage account, and blob storage container required by the app.
4
4
ms.topic: quickstart
5
-
ms.date: 05/01/2025
5
+
ms.date: 07/22/2025
6
6
ms.custom: devx-track-terraform
7
7
ms.service: azure-functions
8
-
author: ggailey777
9
-
ms.author: glenga
10
8
#customer intent: As a Terraform user, I want to learn how to create a function app in a Flex Consumption plan along with required storage account and blob storage container used for deployments.
# Quickstart: Create and deploy Azure Functions resources from Terraform
16
15
17
-
In this quickstart, you use Terraform to create a function app in a Flex Consumption plan in Azure Functions, along with other required Azure resources. The Flex Consumption plan provides serverless hosting that lets you run your code on demand without explicitly provisioning or managing infrastructure. It's used for processing data, integrating systems, internet-of-things computing, and building simple APIs and microservices. The resources created in this configuration include a unique resource group, a storage account, a blob storage container, the Flex Consumption plan, and the function app itself. The function app runs on Linux and is configured to use blob storage for code deployments.
16
+
In this quickstart, you use Terraform to create a function app in a Flex Consumption plan in Azure Functions, along with other required Azure resources. The Flex Consumption plan provides serverless hosting that lets you run your code on demand without explicitly provisioning or managing infrastructure. The function app runs on Linux and is configured to use Azure Blob storage for code deployments.
> If you are using the 4.x azurerm provider, you must [explicitly specify the Azure subscription ID](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/4.0-upgrade-guide#specifying-subscription-id-is-now-mandatory) to authenticate to Azure before running the Terraform commands.
55
-
>
56
-
> One way to specify the Azure subscription ID without putting it in the `providers` block is to specify the subscription ID in an environment variable named `ARM_SUBSCRIPTION_ID`.
57
-
>
58
-
> For more information, see the [Azure provider reference documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#argument-reference).
53
+
1. Use this Azure CLI command to set the `ARM_SUBSCRIPTION_ID` environment variable to the ID of your current subscription:
54
+
55
+
```azurecli
56
+
export ARM_SUBSCRIPTION_ID=$(az account show --query "id" --output tsv)
57
+
```
58
+
59
+
You must have this variable set for Terraform to be able to authenticate to your Azure subscription.
Run [terraform plan](https://www.terraform.io/docs/commands/plan.html) to create an execution plan.
68
+
69
+
::: zone pivot="programming-language-csharp"
70
+
```console
71
+
terraform plan -out main.tfplan -var="runtime_name=dotnet-isolated" -var="runtime_version=8"
72
+
```
73
+
::: zone-end
74
+
::: zone pivot="programming-language-powershell"
75
+
```console
76
+
terraform plan -out main.tfplan -var="runtime_name=powershell" -var="runtime_version=7.4"
77
+
```
78
+
::: zone-end
79
+
::: zone pivot="programming-language-python"
80
+
```console
81
+
terraform plan -out main.tfplan -var="runtime_name=python" -var="runtime_version=3.12"
82
+
```
83
+
::: zone-end
84
+
::: zone pivot="programming-language-java"
85
+
```console
86
+
terraform plan -out main.tfplan -var="runtime_name=java" -var="runtime_version=21"
87
+
```
88
+
::: zone-end
89
+
::: zone pivot="programming-language-javascript,programming-language-typescript"
90
+
```console
91
+
terraform plan -out main.tfplan -var="runtime_name=node" -var="runtime_version=20"
92
+
```
93
+
::: zone-end
94
+
95
+
Make sure that `runtime_version` matches the language stack version you verified locally. Select your preferred language stack at the [top](#top) of the article.
|`resource_group_name`| The name of the resource group you created. |
110
+
|`sa_name`| The name of the Azure storage account required by the Functions host. |
111
+
|`asp_name`| The name of the Flex Consumption plan that hosts your new app. |
112
+
|`fa_name`| The name of your new function app. |
113
+
|`fa_url`| The URL of your new function app endpoint. |
139
114
140
-
Open a browser and enter the following URL: **https://<fa_name>.azurewebsites.net**. Replace the placeholder `<fa_name>` with the value output by Terraform.
115
+
Open a browser and browse to the URL location in `fa_url`. You can also use the [terraform output](https://developer.hashicorp.com/terraform/cli/commands/output) command to review these values at a later time.
0 commit comments