Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies only to:
Foundry (classic) portal. This article isn't available for the new Foundry portal. Learn more about the new portal.
Note
Links in this article might open content in the new Microsoft Foundry documentation instead of the Foundry (classic) documentation you're viewing now.
Important
This article provides legacy support for hub-based projects. It will not work for Foundry projects. See How do I know which type of project I have?
Important
Items marked (preview) in this article are currently in public preview. This preview is provided without a service-level agreement, and we don't recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
Use a Microsoft Bicep template to create a hub for Microsoft Foundry. A template makes it easy to create resources as a single, coordinated operation. A Bicep template is a text document that defines the resources needed for a deployment. It might also specify deployment parameters. You use parameters to provide input values when using the template.
You can find the template used in this article at https://github.com/Azure/azure-quickstart-templates/tree/master/quickstarts/microsoft.machinelearningservices/aifoundry-basics. Both the source main.bicep file and the compiled Azure Resource Manager template (main.json) file are available. This template creates the following resources:
- An Azure resource group (if one doesn't already exist)
- A Foundry hub
- Azure Storage Account
- Azure Key Vault
- Azure Container Registry
- Azure Application Insights
- Foundry resource (created by the template)
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.
RBAC requirements: You must have the Owner or Contributor role on your Azure subscription or resource group to deploy a hub and create resources. If you're deploying to an existing resource group, ensure you have at least Contributor permissions.
A copy of the template 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-basicsdirectory.git clone https://github.com/Azure/azure-quickstart-templates cd azure-quickstart-templates/quickstarts/microsoft.machinelearningservices/aifoundry-basicsThe Bicep command-line tools. To install the Bicep command-line tools, see Install the Bicep CLI.
Understanding the template
The Bicep template is made up of the following files:
| File | Description |
|---|---|
| main.bicep | The main Bicep file that defines the parameters and variables. Passes parameters and variables to other modules in the modules subdirectory. |
| ai-hub.bicep | Defines the hub. |
| dependent-resources.bicep | Defines the dependent resources for the hub such as Azure Storage Account, Container Registry, Key Vault, and Application Insights. |
Important
The example templates might not always use the latest API version for the Azure resources they create. Before using the template, modify it to use the latest API versions. Each Azure service has its own set of API versions. For information on the API for a specific service, check the service information in the Azure REST API reference.
The hub is based on Azure Machine Learning. For information on the latest API versions for Azure Machine Learning, see the Azure Machine Learning REST API reference. To update this API version in your template:
- Open the Bicep file in a text editor
- Find the line with
Microsoft.MachineLearningServices/workspaces@<version> - Replace
<version>with the latest version from the Azure REST API reference (for example,2024-01-01-preview)
The following is an example of the entry for a hub using an API version of 2024-01-01-preview:
resource aiResource 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' = {
Azure Resource Manager template
You use the Bicep domain-specific language (DSL) to define the resources. When you deploy the template, the Bicep file compiles into an Azure Resource Manager template. The main.json file in the GitHub repository is a compiled Azure Resource Manager version of the template. You generate this file from the main.bicep file by using the Bicep command-line tools. For example, deploying the Bicep template generates the main.json file. You can also manually create the main.json file by using the bicep build command without deploying the template.
bicep build main.bicep
For more information, see the Bicep CLI article.
Configure the template
To run the Bicep template, use the following commands from the aifoundry-basics directory:
To create a new Azure resource group, use the following command. Replace
exampleRGwith the name of your resource group, andeastuswith the Azure region to use:az group create --name exampleRG --location eastusTo run the template, use the following command. Replace
myaiwith the name to use for your resources. This value is used, along with generated prefixes and suffixes, to create a unique name for the resources created by the template.Tip
The
aiHubNamemust be five or fewer characters. It can't be entirely numeric or contain the following characters:~ ! @ # $ % ^ & * ( ) = + _ [ ] { } \ | ; : . ' " , < > / ?.az deployment group create --resource-group exampleRG --template-file main.bicep --parameters aiHubName=myaiWhen the command completes successfully, you'll see a message showing the deployment status. The hub and its dependent resources are now created.
Verify your deployment
After the template deployment completes, verify that your resources were created successfully:
In the Azure portal, navigate to your resource group.
Verify that the following resources appear in the resource list:
- Your Foundry hub (named with your hub name)
- Azure Storage Account
- Azure Key Vault
- Azure Container Registry
- Azure Application Insights
- Azure AI Services resource
Select your Foundry hub from the resource list to open it and confirm it's ready to use.
If the deployment fails, check the following:
- Verify your RBAC role has Owner or Contributor permissions
- Ensure the
aiHubNamemeets the naming requirements (5 or fewer characters, not all numeric) - Check that you're using the latest API versions in your template