Microsoft Foundry Skill
This skill helps developers work with Microsoft Foundry resources, covering model discovery and deployment, complete dev lifecycle of AI agent, evaluation workflows, and troubleshooting.
Pre-Execution Requirements
Follow each applicable subsection below before starting its corresponding action or workflow.
Dependency Check and Setup
MANDATORY: As the first step after this skill loads, run the dependency check and setup script below from this skill's root and wait for it to finish before continuing. The script checks first and installs only missing dependencies; it does not reinstall dependencies that are already available.
You MUST complete this check before reading or entering any sub-skill, workflow, or workflow-specific reference.
./scripts/check-and-setup-dependencies.sh # macOS / Linux
./scripts/check-and-setup-dependencies.ps1 # Windows (pwsh)
Strictly follow the script output for subsequent actions.
Workflow Guidance
MANDATORY: Before executing ANY workflow-specific steps, you MUST read the corresponding sub-skill document. Do not call workflow-specific MCP tools for a workflow without reading its skill document. This applies even if you already know the MCP tool parameters — the skill document contains required workflow steps, pre-checks, and validation logic that must be followed. This rule applies on every new user message that triggers a different workflow, even if the skill is already loaded.
Foundry MCP
MANDATORY: Before using Foundry MCP operations, call the Azure MCP foundry tool and inspect the available Foundry MCP tools and related parameters. Treat this as the discovery/help step for MCP-based workflows.
azd
MANDATORY: Before executing ANY azd command, you MUST read azd-guidance and strictly follow the shared rules defined in it, especially the AZURE_DEV_USER_AGENT setting rules.
Sub-Skills
This skill includes specialized sub-skills for specific workflows. When a sub-skill matches the task, strictly follow its workflow:
💡 Tip: For a complete onboarding flow: project/create (public) or private-network (VNet isolation) → models/deploy-model → agent workflows (create → deploy → invoke).
💡 Fine-Tuning: Use finetuning for all model customization — SFT distillation, DPO preference optimization, and RFT with graders. Includes quickstart, grader calibration, and training curve analysis.
💡 Model Deployment: Use models/deploy-model for all deployment scenarios — it intelligently routes between quick preset deployment, customized deployment with full control, and capacity discovery across regions.
💡 Prompt Optimization: For requests like "optimize my prompt" or "improve my agent instructions," load observe and use the prompt_optimize MCP tool through that eval-driven workflow.
Infrastructure Lifecycle
Match user intent to the correct infrastructure workflow.
Agent Development Lifecycle
Match user intent to the correct agent workflow. Read each sub-skill in order before executing.
Agent: .foundry Workspace Standard
Every agent source folder can keep Foundry-specific cache and overlay state under .foundry/:
<agent-root>/
.foundry/
agent-metadata.yaml
agent-metadata.prod.yaml
suites/
datasets/
evaluators/
results/
Agent: Setup References
- Standard Agent Setup — advanced setup for production workloads that need data-residency control (bring-your-own Cosmos DB / Storage / AI Search via a Foundry capability host). The default
azd ai agent flow uses Basic Agent Setup and does not provision capabilityHosts/agents — do not flag its absence as a bug. For default post-provision state, see the "Expected env-var fingerprint" section in foundry-agent/create/create-hosted.md.
Agent: Common Project Context Resolution
Agent skills should run this step only when they need configuration values they don't already have. If a value (for example, agent root, environment, project endpoint, or agent name) is already known from the user's message or a previous skill in the same session, skip resolution for that value.
Step 1: Discover Agent Roots and azd Context
First check whether the workspace has azure.yaml with services using host: azure.ai.agent.
After selecting an agent root, keep all local .foundry cache inspection, source inspection, evaluator suggestions, dataset suggestions, and prompt-optimization context inside that folder only. Do not scan sibling agent folders unless the user explicitly switches roots.
Step 2: Resolve Environment and Deployment Context
If azure.yaml is present, resolve the azd environment first:
- Environment explicitly named by the user
AZURE_ENV_NAME from azd env get-values
- azd default environment from
.azure/config.json
- Environment already selected earlier in the session
Run azd env get-values for the selected environment when project/deployment values are not already known. Prefer azd values for deployment context:
When azd supplies these values, use them as the source of truth and do not copy them into .foundry/agent-metadata*.yaml on metadata writes.
Step 3: Select Metadata Overlay and Resolve Environment
Inside the selected agent root, choose the metadata file in this order:
- Metadata filename or path explicitly provided by the user or workflow
- If an explicit environment is already known and
.foundry/agent-metadata.<env>.yaml exists, use that file
.foundry/agent-metadata.yaml
- If multiple metadata files remain and no rule above selects one, prompt the user to choose
Read the selected metadata file and resolve any remaining environment choice in this order:
- Environment explicitly named by the user
- If the selected metadata file defines exactly one environment, use it
- Environment already selected earlier in the session
defaultEnvironment from metadata
If the selected metadata file still contains multiple environments and none of the rules above selects one, prompt the user to choose. Keep the selected agent root, metadata file, environment, and whether context came from azd or metadata visible in every workflow summary.
If the selected environment exposes older metadata but not , treat as the source for this session and normalize each entry in memory to the shape before continuing. If the metadata is older still and only exposes legacy , normalize that list the same way. Preserve dataset and evaluator fields, keep any existing , and map legacy to only when is missing: -> , -> , -> .
Step 4: Resolve eval.yaml Local Evaluation Intent
If eval.yaml exists in the selected agent root, parse it before generating new suites:
Treat eval.yaml as local evaluation intent, not proof that a Foundry suite exists. Persist synced suite/dataset/evaluator references to .foundry only after remote lookup or registration succeeds.
Step 5: Resolve Common Configuration
Layer sources in this order:
- Explicit user input and values already selected in the session
- azd environment values for deployment context
.foundry/agent-metadata*.yaml overlay values and remote suite/cache references
azure.yaml and eval.yaml local source configuration
- User prompts for anything still missing
If azd and metadata both provide the same value and they differ, stop and ask which source is authoritative. If they match, use the azd value and avoid rewriting the duplicate on future metadata writes.
Step 6: Write Metadata Overlay (Create/Deploy/Observe Only)
On any metadata write (deploy, auto-setup, dataset refresh, or trace-to-dataset update), persist only non-derivable overlay/cache state in the selected metadata file:
- azd binding (
azd.environmentName, azd.service) when useful for future resolution
evaluationSuites[] with remote suite/dataset/evaluator references and local cache paths
lastEval, result files, comparison summaries, or explicit non-azd overrides
Do not copy azd-owned deployment values into metadata when azd already provides them. If the selected file is a preferred single-environment file, rewrite only that one environment block. If the selected file is a legacy multi-environment file, rewrite only the selected environment block. Never copy or merge environments across sibling metadata files automatically. If the selected environment still uses older testSuites[] or legacy testCases[], rewrite it to evaluationSuites[] and remove migrated priority fields from the rewritten entries.
Step 7: Collect Missing Values
Use the ask_user or askQuestions tool only for values not resolved from the user's message, session context, metadata, or azd bootstrap. Common values skills may need:
- Agent root — Target azd service project folder or folder containing
💡 Tip: If the user already provides the agent path, environment, project endpoint, or agent name, extract it directly — do not ask again.
Agent: Agent Types
All agent skills support two agent types:
Treat an azure.yaml service with host: azure.ai.agent as Hosted. Use agent_get only when the type cannot be resolved from project context.
Tool Usage Conventions
- Use the
ask_user or askQuestions tool whenever collecting information from the user
- Use the
task or runSubagent tool to delegate long-running or independent sub-tasks (e.g., env var scanning, status polling, Dockerfile generation)
- Prefer azd for Hosted Agents and Foundry MCP for Prompt Agents.
- Reference official Microsoft documentation URLs instead of embedding CLI command syntax
Azure Authentication
Additional Resources
Network Isolation Errors
Applies to any call against a Foundry project or its parent Foundry account — Foundry MCP tools, azd, az CLI, curl, REST, or SDK.
If an error matches Public access is disabled / PublicNetworkAccessDisabled / 403 Forbidden from a private endpoint / connection timeout / the project endpoint FQDN resolves to a public IP, this typically means the parent Foundry account has publicNetworkAccess=Disabled or Enabled from selected IP addresses, and the current shell is outside its VNet.
Only if the error is ambiguous, confirm against the Foundry account using a management-plane call (works from anywhere with reader access):
az cognitiveservices account show \
--name <account> --resource-group <rg> \
--query "properties.{publicNetworkAccess:publicNetworkAccess, networkAcls:networkAcls, privateEndpointConnections:privateEndpointConnections[].properties.privateLinkServiceConnectionState.status}"
publicNetworkAccess: "Disabled" — or "Enabled" together with non-empty networkAcls.ipRules / virtualNetworkRules — confirms isolation. If publicNetworkAccess: "Enabled" and networkAcls is empty, the failure is a caller-side network issue (e.g. Private DNS resolving the FQDN to a public IP from inside a VNet with a private endpoint), not an account-config issue.
If it's indeed a network isolation issue, supported connection options are documented in Choose a secure connection method to Foundry.
ℹ️ Foundry MCP tools cannot reach a VNet-isolated project even from inside the VNet.