Skip to content

Commit cb62a86

Browse files
authored
Merge pull request #279190 from TomArcherMsft/UserStory208753
User Story 208753
2 parents 8656a15 + 00375aa commit cb62a86

File tree

2 files changed

+94
-4
lines changed

2 files changed

+94
-4
lines changed
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
---
2-
title: terraform samples
3-
description: Find terraform samples for some of the common App Service scenarios. Learn how to automate your App Service deployment or management tasks.
2+
title: Terraform samples
3+
description: Find Terraform samples for some of the common App Service scenarios. Learn how to automate your App Service deployment or management tasks.
44
tags: azure-service-management
55
ms.custom: devx-track-terraform
66

77
ms.assetid: 1e5ecfa8-4ab1-47d3-ab23-97abf723516d
88
ms.topic: sample
9-
ms.date: 11/18/2022
9+
ms.date: 06/25/2024
1010
author: ericgre
1111
ms.author: ericg
1212
ms.service: app-service
1313
---
1414
# Terraform samples for Azure App Service
1515

16-
The following table includes links to terraform scripts.
16+
The following table includes links to Terraform scripts.
1717

1818
| Script | Description |
1919
|-|-|
2020
|**Create app**||
2121
| [Create two apps and connect securely with Private Endpoint and VNet integration](./scripts/terraform-secure-backend-frontend.md)| Creates two App Service apps and connect apps together with Private Endpoint and VNet integration. |
2222
| [Provision App Service and use slot swap to deploy](/azure/developer/terraform/provision-infrastructure-using-azure-deployment-slots)| Provision App Service infrastructure with Azure deployment slots. |
23+
| [Create an Azure Windows web app with a backup](./scripts/terraform-backup.md)| Create an Azure Windows web app with a backup schedule. |
2324
| | |
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: 'Quickstart: Create an Azure Windows web app with a backup using Terraform'
3+
description: In this quickstart, you create an Azure Windows web app with a backup schedule and a .NET application stack.
4+
ms.topic: quickstart
5+
ms.date: 07/02/2024
6+
ms.custom: devx-track-terraform
7+
ms.service: app-service
8+
author: msangapu-msft
9+
ms.author: msangapu
10+
customer intent: As a Terraform user, I want to see how to create an Azure Windows web app with a backup schedule and a .NET application stack.
11+
---
12+
13+
# Quickstart: Create an Azure Windows web app with a backup using Terraform
14+
15+
In Azure App Service, you can make on-demand custom backups or configure scheduled custom backups. In this quickstart, you use Terraform to create an Azure Windows web app with a backup schedule and a .NET application stack. For more information about App Service backups and restores, see [Back up and restore your app in Azure App Service](/azure/app-service/manage-backup?tabs=portal).
16+
17+
[!INCLUDE [About Terraform](~/azure-dev-docs-pr/articles/terraform/includes/abstract.md)]
18+
19+
> [!div class="checklist"]
20+
> * Create an Azure storage account and container with the randomly generated name .
21+
> * Create an Azure service plan with the randomly generated name .
22+
> * Generate a Shared Access Signature (SAS) for the storage account.
23+
> * Create an Azure Windows web app with the randomly generated name .
24+
> * Configure a backup schedule for the web app.
25+
> * Specify the application stack for the web app.
26+
> * Output the names of key resources created with the Terraform script.
27+
> * Output the default hostname of the Windows web app.
28+
29+
## Prerequisites
30+
31+
- Create an Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
32+
33+
- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure)
34+
35+
## Implement the Terraform code
36+
37+
> [!NOTE]
38+
> 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-backup). 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-backup/TestRecord.md).
39+
>
40+
> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform)
41+
42+
1. Create a directory in which to test and run the sample Terraform code and make it the current directory.
43+
44+
1. Create a file named `providers.tf` and insert the following code.
45+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-backup/providers.tf":::
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-backup/main.tf":::
49+
50+
1. Create a file named `variables.tf` and insert the following code.
51+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-backup/variables.tf":::
52+
53+
1. Create a file named `outputs.tf` and insert the following code.
54+
:::code language="Terraform" source="~/terraform_samples/quickstart/101-app-service-backup/outputs.tf":::
55+
56+
## Initialize Terraform
57+
58+
[!INCLUDE [terraform-init.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)]
59+
60+
## Create a Terraform execution plan
61+
62+
[!INCLUDE [terraform-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)]
63+
64+
## Apply a Terraform execution plan
65+
66+
[!INCLUDE [terraform-apply-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)]
67+
68+
## Verify the results
69+
70+
Run [az webapp show](/cli/azure/webapp#az-webapp-show) to view the Azure Windows web app.
71+
72+
```azurecli
73+
az webapp show --name <web_app_name> --resource-group <resource_group_name>
74+
```
75+
76+
Replace `<web_app_name>` with the name of your Azure Windows web app and `<resource_group_name>` with the name of your resource group.
77+
78+
## Clean up resources
79+
80+
[!INCLUDE [terraform-plan-destroy.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)]
81+
82+
## Troubleshoot Terraform on Azure
83+
84+
[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot).
85+
86+
## Next steps
87+
88+
> [!div class="nextstepaction"]
89+
> [See more articles about App Service](/azure/app-service)

0 commit comments

Comments
 (0)