แก้ไข

แชร์ผ่าน


Quickstart: Create a Microsoft Foundry resource using a Bicep file

Use a Microsoft Bicep file (template) to create a Microsoft Foundry resource. A template makes it easy to create resources as a single, coordinated operation. A Bicep file is a text document that defines the resources that are needed for a deployment. It might also specify deployment parameters. You use parameters to provide input values when deploying resources by using the file.

Prerequisites

An Azure account with an active subscription. If you don't have one, create a free Azure account, which includes a free trial subscription.

  • A copy of the files from the GitHub repo. To clone the GitHub repo to your local machine, you can use Git. Use the following command to clone the quickstart repository to your local machine and navigate to the aifoundry-basics directory.

    git clone https://github.com/Azure-AI-Foundry/foundry-samples
    cd foundry-samples/infrastructure/infrastructure-setup-bicep/00-basic
    
  • The Bicep command-line tools. To install the Bicep CLI, see Install the Bicep CLI.

  • Access to a role that allows you to complete role assignments, such as Owner. For more information about permissions, see Role-based access control for Microsoft Foundry.

Deploy the Bicep file

Deploy the Bicep file by using either Azure CLI or Azure PowerShell.

az group create --name exampleRG --location eastus
az deployment group create --resource-group exampleRG --template-file main.bicep --parameters aiFoundryName=myai aiProjectName=myai-proj 

Reference: az group create, az deployment group create

Note

Replace myai with the name of your resource. exampleRG is the name of the resource group, and eastus is the Azure region where resources are deployed.

When the deployment finishes, you see a message indicating the deployment succeeded (output displays: "provisioningState": "Succeeded"). This confirms that your Foundry resource and project have been created.

Review the Bicep file (optional)

Optionally, review the Bicep template to understand the resource definitions.

You can find the Bicep file used in this article at https://github.com/azure-ai-foundry/foundry-samples/tree/main/infrastructure/infrastructure-setup-bicep/00-basic.

This template creates the following resources:

Review deployed resources

Use the Foundry portal to view the created resources. You can also use Azure CLI or Azure PowerShell to list the resources.

az resource list --resource-group exampleRG

Clean up resources

If you plan to continue working with subsequent quickstarts and tutorials, you can keep the resources you created in this quickstart. If you want to remove the resources, use the following command.

az group delete --name exampleRG

Reference: az group delete