|
| 1 | +--- |
| 2 | +title: 'Use Terraform to create an Azure AI Studio hub' |
| 3 | +description: In this article, you create an Azure AI hub, an AI project, an AI services resource, and more resources. |
| 4 | +ms.topic: how-to |
| 5 | +ms.date: 07/12/2024 |
| 6 | +titleSuffix: Azure AI Studio |
| 7 | +ms.service: azure-ai-studio |
| 8 | +manager: scottpolly |
| 9 | +ms.reviewer: andyaviles |
| 10 | +ms.author: larryfr |
| 11 | +author: Blackmist |
| 12 | +ms.custom: devx-track-terraform |
| 13 | +content_well_notification: |
| 14 | + - AI-contribution |
| 15 | +ai-usage: ai-assisted |
| 16 | +#customer intent: As a Terraform user, I want to see how to create an Azure AI Studio hub and its associated resources. |
| 17 | +--- |
| 18 | + |
| 19 | +# Use Terraform to create an Azure AI Studio hub |
| 20 | + |
| 21 | +In this article, you use Terraform to create an Azure AI Studio hub, a project, and AI services connection. A hub is a central place for data scientists and developers to collaborate on machine learning projects. It provides a shared, collaborative space to build, train, and deploy machine learning models. The hub is integrated with Azure Machine Learning and other Azure services, making it a comprehensive solution for machine learning tasks. The hub also allows you to manage and monitor your AI deployments, ensuring they're performing as expected. |
| 22 | + |
| 23 | +[!INCLUDE [About Terraform](~/azure-dev-docs-pr/articles/terraform/includes/abstract.md)] |
| 24 | + |
| 25 | +> [!div class="checklist"] |
| 26 | +> * Create a resource group |
| 27 | +> * Set up a storage account |
| 28 | +> * Establish a key vault |
| 29 | +> * Configure AI services |
| 30 | +> * Build an Azure AI hub |
| 31 | +> * Develop an AI project |
| 32 | +> * Establish an AI services connection |
| 33 | +
|
| 34 | +## Prerequisites |
| 35 | + |
| 36 | +- Create an Azure account with an active subscription. You can [create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F). |
| 37 | + |
| 38 | +- [Install and configure Terraform](/azure/developer/terraform/quickstart-configure) |
| 39 | + |
| 40 | +## Implement the Terraform code |
| 41 | + |
| 42 | +> [!NOTE] |
| 43 | +> The sample code for this article is located in the [Azure Terraform GitHub repo](https://github.com/Azure/terraform/tree/master/quickstart/101-ai-studio). 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-ai-studio/TestRecord.md). |
| 44 | +> |
| 45 | +> See more [articles and sample code showing how to use Terraform to manage Azure resources](/azure/terraform) |
| 46 | +
|
| 47 | +1. Create a directory in which to test and run the sample Terraform code and make it the current directory. |
| 48 | + |
| 49 | +1. Create a file named `providers.tf` and insert the following code. |
| 50 | + |
| 51 | + :::code language="Terraform" source="~/terraform_samples/quickstart/101-ai-studio/providers.tf"::: |
| 52 | + |
| 53 | +1. Create a file named `main.tf` and insert the following code. |
| 54 | + |
| 55 | + :::code language="Terraform" source="~/terraform_samples/quickstart/101-ai-studio/main.tf"::: |
| 56 | + |
| 57 | +1. Create a file named `variables.tf` and insert the following code. |
| 58 | + |
| 59 | + :::code language="Terraform" source="~/terraform_samples/quickstart/101-ai-studio/variables.tf"::: |
| 60 | + |
| 61 | +1. Create a file named `outputs.tf` and insert the following code. |
| 62 | + |
| 63 | + :::code language="Terraform" source="~/terraform_samples/quickstart/101-ai-studio/outputs.tf"::: |
| 64 | + |
| 65 | +## Initialize Terraform |
| 66 | + |
| 67 | +[!INCLUDE [terraform-init.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-init.md)] |
| 68 | + |
| 69 | +## Create a Terraform execution plan |
| 70 | + |
| 71 | +[!INCLUDE [terraform-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan.md)] |
| 72 | + |
| 73 | +## Apply a Terraform execution plan |
| 74 | + |
| 75 | +[!INCLUDE [terraform-apply-plan.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-apply-plan.md)] |
| 76 | + |
| 77 | +## Verify the results |
| 78 | + |
| 79 | +### [Azure CLI](#tab/azure-cli) |
| 80 | + |
| 81 | +1. Get the Azure resource group name. |
| 82 | + |
| 83 | + ```console |
| 84 | + resource_group_name=$(terraform output -raw resource_group_name) |
| 85 | + ``` |
| 86 | + |
| 87 | +1. Get the workspace name. |
| 88 | + |
| 89 | + ```console |
| 90 | + workspace_name=$(terraform output -raw workspace_name) |
| 91 | + ``` |
| 92 | + |
| 93 | +1. Run [az ml workspace show](/cli/azure/ml/workspace#az-ml-workspace-show) to display information about the new workspace. |
| 94 | + |
| 95 | + ```azurecli |
| 96 | + az ml workspace show --resource-group $resource_group_name \ |
| 97 | + --name $workspace_name |
| 98 | + ``` |
| 99 | + |
| 100 | +### [Azure PowerShell](#tab/azure-powershell) |
| 101 | + |
| 102 | +1. Get the Azure resource group name. |
| 103 | + |
| 104 | + ```console |
| 105 | + $resource_group_name=$(terraform output -raw resource_group_name) |
| 106 | + ``` |
| 107 | + |
| 108 | +1. Get the workspace name. |
| 109 | + |
| 110 | + ```console |
| 111 | + $workspace_name=$(terraform output -raw workspace_name) |
| 112 | + ``` |
| 113 | + |
| 114 | +1. Run [Get-AzMLWorkspace](/powershell/module/az.machinelearningservices/get-azmlworkspace) to display information about the new workspace. |
| 115 | + |
| 116 | + ```azurepowershell |
| 117 | + Get-AzMLWorkspace -ResourceGroupName $resource_group_name ` |
| 118 | + -Name $workspace_name |
| 119 | + ``` |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +## Clean up resources |
| 124 | + |
| 125 | +[!INCLUDE [terraform-plan-destroy.md](~/azure-dev-docs-pr/articles/terraform/includes/terraform-plan-destroy.md)] |
| 126 | + |
| 127 | +## Troubleshoot Terraform on Azure |
| 128 | + |
| 129 | +[Troubleshoot common problems when using Terraform on Azure](/azure/developer/terraform/troubleshoot). |
| 130 | + |
| 131 | +## Next steps |
| 132 | + |
| 133 | +> [!div class="nextstepaction"] |
| 134 | +> [See more articles about Azure AI Studio hub](/search/?terms=Azure%20ai%20hub%20and%20terraform) |
| 135 | + |
0 commit comments