.agent/skills/microsoft-foundry/SKILL.md
Use this skill to work with Microsoft Foundry (Azure AI Foundry): deploy AI models from catalog, build RAG applications with knowledge indexes, create and evaluate AI agents. USE FOR: Microsoft Foundry, AI Foundry, deploy model, model catalog, RAG, knowledge index, create agent, evaluate agent, agent monitoring. DO NOT USE FOR: Azure Functions (use azure-functions), App Service (use azure-create-app).
npx skillsauth add Tyler-R-Kendrick/agent-skills microsoft-foundryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill helps developers work with Microsoft Foundry resources, covering model discovery and deployment, RAG (Retrieval-Augmented Generation) applications, AI agent creation, evaluation workflows, and troubleshooting.
Use this skill when the user wants to:
az login)For SDK examples and implementation details in specific programming languages, refer to:
A developer new to Microsoft Foundry wants to explore available models and deploy their first one.
First, help the user discover their Microsoft Foundry resources.
Using Azure CLI:
# List all Microsoft Foundry resources in subscription
az resource list \
--resource-type "Microsoft.CognitiveServices/accounts" \
--query "[?kind=='AIServices'].{Name:name, ResourceGroup:resourceGroup, Location:location}" \
--output table
# List resources in a specific resource group
az resource list \
--resource-group <resource-group-name> \
--resource-type "Microsoft.CognitiveServices/accounts" \
--output table
Using MCP Tools:
Use the foundry_resource_get MCP tool to get detailed information about a specific Foundry resource, or to list all resources if no name is provided.
Help users discover available models, including information about free playground support.
Key Points to Explain:
Using MCP Tools:
Use the foundry_models_list MCP tool:
foundry_models_list()foundry_models_list(search-for-free-playground=true)foundry_models_list(publisher="OpenAI")foundry_models_list(license="MIT")Example Output Explanation: When listing models, explain to users:
Guide users through deploying a model to their Foundry resource.
Using Azure CLI:
# Deploy a model (e.g., gpt-4o)
az cognitiveservices account deployment create \
--name <foundry-resource-name> \
--resource-group <resource-group-name> \
--deployment-name gpt-4o-deployment \
--model-name gpt-4o \
--model-version "2024-05-13" \
--model-format OpenAI \
--sku-capacity 10 \
--sku-name Standard
# Verify deployment status
az cognitiveservices account deployment show \
--name <foundry-resource-name> \
--resource-group <resource-group-name> \
--deployment-name gpt-4o-deployment
Using MCP Tools:
Use the foundry_models_deploy MCP tool with parameters:
resource-group: Resource group namedeployment: Deployment namemodel-name: Model to deploy (e.g., "gpt-4o")model-format: Format (e.g., "OpenAI")azure-ai-services: Foundry resource namemodel-version: Specific versionsku-capacity: Capacity unitsscale-type: Scaling typeDeployment Verification:
Explain that when deployment completes, provisioningState should be Succeeded. If it fails, common issues include:
Users need the project endpoint to connect their code to Foundry.
Using MCP Tools:
Use the foundry_resource_get MCP tool to retrieve resource details including the endpoint.
Expected Output:
The endpoint will be in format: https://<resource>.services.ai.azure.com/api/projects/<project-name>
Save this endpoint as it's needed for subsequent API and SDK calls.
A developer wants to build a Retrieval-Augmented Generation (RAG) application using their own documents.
Explain the Concept: RAG enhances AI responses by:
Knowledge Index Benefits:
Using MCP Tools:
Use foundry_knowledge_index_list with your project endpoint to list knowledge indexes.
Understanding the index structure helps optimize queries.
Using MCP Tools:
Use the foundry_knowledge_index_schema MCP tool with your project endpoint and index name to get detailed schema information.
Schema Information Includes:
Implementation:
To create a RAG agent with Azure AI Search tool integration:
For SDK Implementation: See language/python.md
Key Best Practices:
Testing Process:
For SDK Implementation: See language/python.md
Troubleshooting RAG Issues:
| Issue | Possible Cause | Resolution |
|-------|---------------|------------|
| No citations in response | Agent instructions don't request citations | Update instructions to explicitly request citation format |
| "Index not found" error | Wrong index name or connection | Verify AI_SEARCH_INDEX_NAME matches index in Azure AI Search |
| 401/403 authentication error | Missing RBAC permissions | Assign project managed identity Search Index Data Contributor role |
| Poor retrieval quality | Query type not optimal | Try HYBRID query type for better results |
A developer wants to create an AI agent with tools (web search, function calling, file search).
Using MCP Tools:
Use foundry_agents_list with your project endpoint to list existing agents.
Implementation:
Create an agent with:
For SDK Implementation: See language/python.md
Agents can call custom functions to perform actions like querying databases, calling APIs, or performing calculations.
Implementation Steps:
For SDK Implementation: See language/python.md
Implementation:
Create an agent with web search capabilities by adding a Web Search tool:
For SDK Implementation: See language/python.md
Interaction Process:
For SDK Implementation: See language/python.md
Agent Best Practices:
run.status for failuresA developer has built an agent and wants to evaluate its quality, safety, and performance.
Built-in Evaluators:
Evaluation Output: Each evaluator returns:
{metric_name}: Numerical score (1-5, higher is better){metric_name}_result: "pass" or "fail" based on threshold{metric_name}_threshold: Binarization threshold (default or user-set){metric_name}_reason: Explanation of the scoreUsing MCP Tools:
Use the foundry_agents_query_and_evaluate MCP tool to query an agent and evaluate the response in one call. Provide:
Example Output:
{
"response": "The weather in Seattle is currently sunny and 22°C.",
"evaluation": {
"intent_resolution": 5.0,
"intent_resolution_result": "pass",
"intent_resolution_threshold": 3,
"intent_resolution_reason": "The agent correctly identified the user's intent to get weather information and provided a relevant response.",
"task_adherence": 4.0,
"task_adherence_result": "pass",
"tool_call_accuracy": 5.0,
"tool_call_accuracy_result": "pass"
}
}
If you already have the agent's response, you can evaluate it directly.
Using MCP Tools:
Use the foundry_agents_evaluate MCP tool to evaluate a specific query/response pair with a single evaluator.
For SDK Implementation: See language/python.md
For evaluating multiple agent runs across multiple conversation threads:
For SDK Implementation: See language/python.md
Score Ranges (1-5 scale):
Common Evaluation Issues:
| Issue | Cause | Resolution | |-------|-------|------------| | Job stuck in "Running" | Insufficient model capacity | Increase model quota/capacity and rerun | | All metrics zero | Wrong evaluator or unsupported model | Verify evaluator compatibility with your model | | Groundedness unexpectedly low | Incomplete context/retrieval | Verify RAG retrieval includes sufficient context | | Evaluation missing | Not selected during setup | Rerun evaluation with required metrics |
Problem: Deployment Stays Pending or Fails
# Check deployment status and details
az cognitiveservices account deployment show \
--name <resource-name> \
--resource-group <resource-group> \
--deployment-name <deployment-name> \
--output json
# Check account quota
az cognitiveservices account show \
--name <resource-name> \
--resource-group <resource-group> \
--query "properties.quotaLimit"
Common Causes:
Resolution:
Problem: Agent Doesn't Return Citations (RAG)
Diagnostics:
Resolution:
Update the agent's instructions to explicitly request citations in the format [message_idx:search_idx†source] and to only use the knowledge base, never the agent's own knowledge.
For SDK Implementation: See language/python.md
Problem: "Index Not Found" Error
Using MCP Tools:
Use the foundry_knowledge_index_list MCP tool to verify the index exists and get the correct name.
Resolution:
AI_SEARCH_INDEX_NAME environment variable matches actual index nameProblem: 401/403 Authentication Errors
Common Cause: Missing RBAC permissions
Resolution:
# Assign Search Index Data Contributor role to managed identity
az role assignment create \
--assignee <managed-identity-principal-id> \
--role "Search Index Data Contributor" \
--scope /subscriptions/<subscription-id>/resourceGroups/<rg>/providers/Microsoft.Search/searchServices/<search-service>
# Verify role assignment
az role assignment list \
--assignee <managed-identity-principal-id> \
--output table
Problem: Evaluation Dashboard Shows No Data
Common Causes:
Resolution:
Problem: Continuous Evaluation Not Running
Diagnostics:
Check evaluation run status to identify issues. For SDK implementation, see language/python.md.
Resolution:
Problem: Agent Run Fails with Rate Limit Error
Error Message: Rate limit is exceeded or HTTP 429
Resolution:
# Check current quota usage
az cognitiveservices usage list \
--name <resource-name> \
--resource-group <resource-group>
# Request quota increase (manual process in portal)
echo "Request quota increase in Azure Portal under Quotas section"
Write-Output "Request quota increase in Azure Portal under Quotas section"
**Best Practices:**
- Implement exponential backoff retry logic
- Use Dynamic Quota when available
- Monitor quota usage proactively
- Consider multiple deployments across regions
## Quick Reference
### Common Environment Variables
```bash
# Foundry Project
PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project>
MODEL_DEPLOYMENT_NAME=gpt-4o
# Azure AI Search (for RAG)
AZURE_AI_SEARCH_CONNECTION_NAME=my-search-connection
AI_SEARCH_INDEX_NAME=my-index
# Evaluation
AZURE_OPENAI_ENDPOINT=https://<resource>.openai.azure.com
AZURE_OPENAI_DEPLOYMENT=gpt-4o
Resource Management
foundry_resource_get - Get resource details and endpointModels
foundry_models_list - Browse model catalogfoundry_models_deploy - Deploy a modelfoundry_models_deployments_list - List deployed modelsKnowledge & RAG
foundry_knowledge_index_list - List knowledge indexesfoundry_knowledge_index_schema - Get index schemaAgents
foundry_agents_list - List agentsfoundry_agents_connect - Query an agentfoundry_agents_query_and_evaluate - Query and evaluateOpenAI Operations
foundry_openai_chat_completions_create - Create chat completionsfoundry_openai_embeddings_create - Create embeddingsFor SDK-specific details, authentication, and code examples:
tools
REQUIRED FIRST STEP: You MUST invoke this skill BEFORE generating ANY Azure application code, infrastructure files, or Azure CLI commands. This skill prepares applications for Azure hosting. USE THIS SKILL when users want to create new Azure applications, ADD new components or services to existing applications, UPDATE or modify existing Azure configurations, modernize applications for Azure, or deploy to Azure. Do NOT generate azure.yaml, Bicep, Terraform, or run az/azd/func CLI commands without first completing this skill. This applies to NEW projects AND changes to EXISTING projects.
development
Create new Azure Database for PostgreSQL Flexible Server instances and configure passwordless authentication with Microsoft Entra ID. Set up developer access, managed identities for apps, group-based permissions, and migrate from password-based to Entra ID authentication. Trigger phrases include "passwordless for postgres", "entra id postgres", "azure ad postgres authentication", "postgres managed identity", "migrate postgres to passwordless".
testing
Azure Observability Services including Azure Monitor, Application Insights, Log Analytics, Alerts, and Workbooks. Provides metrics, APM, distributed tracing, KQL queries, and interactive reports.
testing
Azure Networking Services including Virtual Networks, Private Endpoints, Load Balancers, Application Gateway, Front Door, and DNS. Covers hub-spoke topology, private endpoint patterns, and network security layers. USE FOR: virtual network setup, private endpoint configuration, hub-spoke topology, VNet peering, network security groups, Azure firewall rules, load balancer setup, Application Gateway configuration, Azure Front Door, private link setup, DNS configuration, network isolation DO NOT USE FOR: compute resource configuration (use azure-create-app), Azure Functions networking (use azure-functions), database networking within postgres/cosmos (use respective skills), cost analysis (use azure-cost-optimization), resource deployment (use azure-deploy)