|
| 1 | +--- |
| 2 | +title: 'Quickstart: Create an Azure Analysis Services server using Terraform' |
| 3 | +description: 'In this article, you create an Azure Analysis Services server using Terraform' |
| 4 | +ms.topic: quickstart |
| 5 | +ms.service: azure-analysis-services |
| 6 | +ms.date: 3/10/2023 |
| 7 | +ms.custom: devx-track-terraform |
| 8 | +author: TomArcherMsft |
| 9 | +ms.author: tarcher |
| 10 | +--- |
| 11 | + |
| 12 | +# Quickstart: Create an Azure Analysis Services server using Terraform |
| 13 | + |
| 14 | +This article shows how to use [Terraform](/azure/terraform) to create an [Azure Analysis Services](/azure/analysis-services/analysis-services-overview) server. |
| 15 | + |
| 16 | +In this article, you learn how to: |
| 17 | + |
| 18 | +> [!div class="checklist"] |
| 19 | +> * Create a random pet name for the Azure resource group name using [random_pet](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) |
| 20 | +> * Create an Azure resource group using [azurerm_resource_group](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) |
| 21 | +> * Create a random string for the Azure Analysis Services server name using [random_string](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/string) |
| 22 | +> * Create an Azure Analysis Services server using [azurerm_analysis_services_server](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/analysis_services_server) |
| 23 | +
|
| 24 | +[!INCLUDE [AI attribution](../../includes/ai-generated-attribution.md)] |
| 25 | + |
| 26 | +## Prerequisites |
| 27 | + |
| 28 | +- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure) |
| 29 | + |
| 30 | +## Implement the Terraform code |
| 31 | + |
| 32 | +> [!NOTE] |
| 33 | +> The sample code for this article is located in the [Azure Terraform GitHub repo](https://github.com/Azure/terraform/tree/master/quickstart/101-analysis-services-create). 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-analysis-services-create/TestRecord.md). |
| 34 | +> |
| 35 | +> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform) |
| 36 | +
|
| 37 | +1. Create a directory in which to test and run the sample Terraform code and make it the current directory. |
| 38 | + |
| 39 | +1. Create a file named `main.tf` and insert the following code: |
| 40 | + |
| 41 | + [!code-terraform[master](~/terraform_samples/quickstart/101-analysis-services-create/main.tf)] |
| 42 | + |
| 43 | +1. Create a file named `outputs.tf` and insert the following code: |
| 44 | + |
| 45 | + [!code-terraform[master](~/terraform_samples/quickstart/101-analysis-services-create/outputs.tf)] |
| 46 | + |
| 47 | +1. Create a file named `providers.tf` and insert the following code: |
| 48 | + |
| 49 | + [!code-terraform[master](~/terraform_samples/quickstart/101-analysis-services-create/providers.tf)] |
| 50 | + |
| 51 | +1. Create a file named `variables.tf` and insert the following code: |
| 52 | + |
| 53 | + [!code-terraform[master](~/terraform_samples/quickstart/101-analysis-services-create/variables.tf)] |
| 54 | + |
| 55 | +## Initialize Terraform |
| 56 | + |
| 57 | +[!INCLUDE [terraform-init.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)] |
| 58 | + |
| 59 | +## Create a Terraform execution plan |
| 60 | + |
| 61 | +[!INCLUDE [terraform-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)] |
| 62 | + |
| 63 | +## Apply a Terraform execution plan |
| 64 | + |
| 65 | +[!INCLUDE [terraform-apply-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)] |
| 66 | + |
| 67 | +## Verify the results |
| 68 | + |
| 69 | +1. Get the Azure resource group name. |
| 70 | + |
| 71 | + ```console |
| 72 | + echo "$(terraform output resource_group_name)" |
| 73 | + ``` |
| 74 | + |
| 75 | +1. Get the server name. |
| 76 | + |
| 77 | + ```console |
| 78 | + echo "$(terraform output analysis_services_server_name)" |
| 79 | + ``` |
| 80 | + |
| 81 | +1. Run [Get-AzAnalysisServicesServer](/powershell/module/az.analysisservices/get-azanalysisservicesserver) to display information about the new server. |
| 82 | + |
| 83 | + ```azurepowershell |
| 84 | + Get-AzAnalysisServicesServer -ResourceGroupName <resource_group_name> ` |
| 85 | + -Name <analysis_services_server_name> |
| 86 | + ``` |
| 87 | + |
| 88 | +## Clean up resources |
| 89 | + |
| 90 | +[!INCLUDE [terraform-plan-destroy.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)] |
| 91 | + |
| 92 | +## Troubleshoot Terraform on Azure |
| 93 | + |
| 94 | +[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot) |
| 95 | + |
| 96 | +## Next steps |
| 97 | + |
| 98 | +> [!div class="nextstepaction"] |
| 99 | +> [Quickstart: Configure server firewall - Portal](analysis-services-qs-firewall.md) |
0 commit comments