Skip to content

Commit c7039d8

Browse files
committed
updates1
1 parent 8cae26e commit c7039d8

File tree

1 file changed

+138
-0
lines changed

1 file changed

+138
-0
lines changed
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
---
2+
title: 'Quickstart: Use Terraform to configure an Azure App Service Environment v3'
3+
description: In this quickstart, you create an Azure resource group, a virtual network, and a subnet with unique, randomly generated names to configure an Azure App Service Environment v3.
4+
ms.topic: quickstart
5+
ms.date: 03/20/2025
6+
ms.custom: devx-track-terraform
7+
ms.service: azure-app-service
8+
author: cephalin
9+
ms.author: cephalin
10+
#customer intent: As a Terraform user, I want to learn how to create an Azure resource group, virtual network, and subnet to configure an Azure App Service Environment v3.
11+
content_well_notification:
12+
- AI-contribution
13+
---
14+
15+
# 'Quickstart: Use Terraform to configure an Azure App Service Environment v3'
16+
17+
In this quickstart, you use Terraform to create a resource group, virtual network, and a subnet to configure an Azure App Service Environment v3. This code creates a resource group, a container that holds related resources for an Azure solution; a virtual network; and a subnet to provide network isolation and segmentation for the App Service Environment. App Service Environment v3 is a fully isolated environment that's dedicated to securely run App Service apps at high scale. It's typically used when you need to host many apps in a one region, deploy apps into a virtual network, or when you need to use a lot of memory.
18+
19+
[!INCLUDE [About Terraform](~/azure-dev-docs-pr/articles/terraform/includes/abstract.md)]
20+
21+
> [!div class="checklist"]
22+
> * Create an Azure resource group with a unique name.
23+
> * Establish a virtual network with a specified name and address.
24+
> * Generate a random name for the subnet, and create a subnet in the virtual network.
25+
> * Delegate the subnet to the Microsoft.Web/hostingEnvironments service.
26+
> * Generate a random name for the App Service Environment v3, and create an App Service Environment v3 in the subnet.
27+
> * Set the internal load-balancing mode for the App Service Environment v3.
28+
> * Set cluster settings for the App Service Environment v3.
29+
> * Tag the App Service Environment v3.
30+
> * Output the names of the resource group, virtual network, subnet, and App Service Environment v3.
31+
32+
## Prerequisites
33+
34+
- Create an Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
35+
36+
- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure).
37+
38+
## Implement the Terraform code
39+
40+
> [!NOTE]
41+
> The sample code for this article is located in the [Azure Terraform GitHub repo](https://github.com/Azure/terraform/tree/master/quickstart/101-app-service-environment). You can view the log file containing the [test results from current and previous versions of Terraform](https://github.com/Azure/terraform/tree/master/quickstart/101-app-service-environment/TestRecord.md).
42+
>
43+
> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform).
44+
45+
1. Create a directory in which to test and run the sample Terraform code, and make it the current directory.
46+
47+
1. Create a file named `main.tf`, and insert the following code:
48+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-environment/main.tf":::
49+
50+
1. Create a file named `outputs.tf`, and insert the following code:
51+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-environment/outputs.tf":::
52+
53+
1. Create a file named `providers.tf`, and insert the following code:
54+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-environment/providers.tf":::
55+
56+
1. Create a file named `variables.tf`, and insert the following code:
57+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-environment/variables.tf":::
58+
59+
## Initialize Terraform
60+
61+
[!INCLUDE [terraform-init.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)]
62+
63+
## Create a Terraform execution plan
64+
65+
[!INCLUDE [terraform-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)]
66+
67+
## Apply a Terraform execution plan
68+
69+
[!INCLUDE [terraform-apply-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)]
70+
71+
## Verify the results
72+
73+
### [Azure CLI](#tab/azure-cli)
74+
75+
1. Get the Azure resource group name.
76+
77+
```console
78+
resource_group_name=$(terraform output -raw resource_group_name)
79+
```
80+
81+
1. Get the virtual network name.
82+
83+
```console
84+
virtual_network_name=$(terraform output -raw virtual_network_name)
85+
```
86+
87+
1. Get the subnet name.
88+
89+
```console
90+
subnet_name=$(terraform output -raw subnet_name)
91+
```
92+
93+
1. Run `az appservice ase show` to view the App Service Environment v3.
94+
95+
```azurecli
96+
az appservice ase show --name $app_service_environment_v3_name --resource-group $resource_group_name
97+
```
98+
99+
### [Azure PowerShell](#tab/azure-powershell)
100+
101+
1. Get the Azure resource group name.
102+
103+
```console
104+
$resource_group_name=$(terraform output -raw resource_group_name)
105+
```
106+
107+
1. Get the virtual network name.
108+
109+
```console
110+
$virtual_network_name=$(terraform output -virtual_network_name)
111+
```
112+
113+
1. Get the subnet name.
114+
115+
```console
116+
$subnet_name=$(terraform output -subnet_name)
117+
```
118+
119+
1. Run `Get-AzAppServiceEnvironment` to view the AKS cluster within the Azure Extended Zone.
120+
121+
```azurepowershell
122+
Get-AzAppServiceEnvironment -Name $app_service_environment_v3_name -ResourceGroupName $resource_group_name
123+
```
124+
125+
---
126+
127+
## Clean up resources
128+
129+
[!INCLUDE [terraform-plan-destroy.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)]
130+
131+
## Troubleshoot Terraform on Azure
132+
133+
[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot).
134+
135+
## Next steps
136+
137+
> [!div class="nextstepaction"]
138+
> [See more articles about Azure app service environment v3.](/search/?terms=Azure%20app%20service%20environment%20v3%20and%20terraform)

0 commit comments

Comments
 (0)