Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build and deploy AI applications on Azure AI Foundry using Microsoft's model catalog and AI services
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
project/create/create-foundry-project.md
1---2name: foundry-create-project3description: |4Create a new Azure AI Foundry project using Azure Developer CLI (azd) to provision infrastructure for hosting AI agents and models.5USE FOR: create Foundry project, new AI Foundry project, set up Foundry, azd init Foundry, provision Foundry infrastructure, onboard to Foundry, create Azure AI project, set up AI project.6DO NOT USE FOR: deploying agents to existing projects (use agent/deploy), creating agent code (use agent/create), deploying AI models from catalog (use microsoft-foundry main skill), Azure Functions (use azure-functions).7allowed-tools: Read, Write, Bash, AskUserQuestion8---910# Create Azure AI Foundry Project1112Create a new Azure AI Foundry project using azd. Provisions: Foundry account, project, Application Insights, managed identity, and RBAC permissions. Optionally enables hosted agents (capability host + Container Registry).1314**Table of Contents:** [Prerequisites](#prerequisites) · [Workflow](#workflow) · [Best Practices](#best-practices) · [Troubleshooting](#troubleshooting) · [Related Skills](#related-skills) · [Resources](#resources)1516## Prerequisites1718Run checks in order. STOP on any failure and resolve before proceeding.1920**1. Azure CLI** — `az version` → expects version output. If missing: https://aka.ms/installazurecli2122**2. Azure login & subscription:**2324```bash25az account show --query "{Name:name, SubscriptionId:id, State:state}" -o table26```2728If not logged in, run `az login`. If no active subscription: https://azure.microsoft.com/free/ — STOP.2930If multiple subscriptions, ask which to use, then `az account set --subscription "<id>"`.3132**3. Role permissions:**3334```bash35az role assignment list --assignee "$(az ad signed-in-user show --query id -o tsv)" --query "[?contains(roleDefinitionName, 'Owner') || contains(roleDefinitionName, 'Contributor') || contains(roleDefinitionName, 'Azure AI')].{Role:roleDefinitionName, Scope:scope}" -o table36```3738Requires Owner, Contributor, or Azure AI Owner. If insufficient — STOP, request elevated access from admin.3940**4. Azure Developer CLI** — `azd version`. If missing: https://aka.ms/azure-dev/install4142## Workflow4344### Step 1: Verify azd login4546```bash47azd auth login --check-status48```4950If not logged in, run `azd auth login` and complete browser auth.5152### Step 2: Ask User for Project Details5354Use AskUserQuestion for:55561. **Project name** — used as azd environment name and resource group (`rg-<name>`). Must contain only alphanumeric characters and hyphens. Examples: `my-ai-project`, `dev-agents`572. **Azure location** (optional) — defaults to North Central US (required for hosted agents preview)583. **Enable hosted agents?** (yes/no) — provisions a capability host and Container Registry for deploying hosted agents. Defaults to no.5960### Step 3: Create Directory and Initialize6162```bash63mkdir "<project-name>" && cd "<project-name>"64azd init -t https://github.com/Azure-Samples/azd-ai-starter-basic -e <project-name> --no-prompt65```6667- `-t` — Azure AI starter template (Foundry infrastructure)68- `-e` — environment name69- `--no-prompt` — non-interactive, use defaults70- **IMPORTANT:** `azd init` requires an empty directory7172If user specified a non-default location:7374```bash75azd config set defaults.location <location>76```7778If user chose to enable hosted agents:7980```bash81azd env set ENABLE_HOSTED_AGENTS true82```8384This provisions a capability host (`capabilityHosts/agents`) on the Foundry account and auto-adds an Azure Container Registry for hosted agent deployments.8586### Step 4: Provision Infrastructure8788```bash89azd provision --no-prompt90```9192Takes 5–10 minutes. Creates resource group, Foundry account/project, Application Insights, managed identity, and RBAC roles. If hosted agents enabled, also creates Container Registry and capability host.9394### Step 5: Retrieve Project Details9596```bash97azd env get-values98```99100Capture `AZURE_AI_PROJECT_ID`, `AZURE_AI_PROJECT_ENDPOINT`, and `AZURE_RESOURCE_GROUP`. Direct user to verify at https://ai.azure.com.101102### Step 6: Next Steps103104- Deploy an agent → `agent/deploy` skill105- Browse models → `foundry_models_list` MCP tool106- Manage project → https://ai.azure.com107108## Best Practices109110- Use North Central US for hosted agents (preview requirement)111- Name must be alphanumeric + hyphens only — no spaces, underscores, or special characters112- Delete unused projects with `azd down` to avoid ongoing costs113- `azd down` deletes ALL resources — Foundry account, agents, models, Container Registry, and Application Insights data114- `azd provision` is safe to re-run on failure115116## Troubleshooting117118| Problem | Solution |119|---------|----------|120| `azd: command not found` | Install from https://aka.ms/azure-dev/install |121| `ERROR: Failed to authenticate` | Run `azd auth login`; verify subscription with `az account list` |122| `environment name '' is invalid` | Name must be alphanumeric + hyphens only |123| `ERROR: Insufficient permissions` | Request Contributor or Azure AI Owner role from admin |124| Region not supported for hosted agents | Use `azd config set defaults.location northcentralus` |125| Provisioning timeout | Check region availability, verify connectivity, retry `azd provision` |126127## Related Skills128129- **agent/deploy** — Deploy agents to the created project130- **agent/create** — Create a new agent for deployment131132## Resources133134- [Azure Developer CLI](https://aka.ms/azure-dev/install) · [AI Foundry Portal](https://ai.azure.com) · [Foundry Docs](https://learn.microsoft.com/azure/ai-foundry/) · [azd-ai-starter-basic template](https://github.com/Azure-Samples/azd-ai-starter-basic)135