Azure Foundry Agent Skill
Invoke Azure Foundry agents using the Azure MCP tools. This skill enables discovering Foundry resources, listing agents, and invoking agents for task classification and other AI workflows.
Configuration
Copy config.example.yaml to config.yaml and customize:
# Azure subscription (optional - uses current if not set)
subscription: ""
# Foundry resource name (from foundry_resource_get)
resource: "shboyer-copilot-proj-resource"
# Project name
project: "shboyer-copilot-proj"
# Default agent
agent: "priority-detection-agent"
# Keywords that trigger this skill
triggers:
- "rate my task"
- "prioritize"
The endpoint is constructed automatically:
https://<resource>.services.ai.azure.com/api/projects/<project>
When a user message contains any trigger keyword, use this skill's workflow.
Prerequisites
- Azure MCP tools must be available (
azure-mcp-foundry) - User must be authenticated to Azure (
az login) - A Foundry project with deployed agents
Workflow
Step 1: Get Current Subscription
First, determine the user's current Azure subscription:
az account show --query "{subscriptionId:id, name:name}" -o json
Step 2: List Foundry Resources
Use the Azure MCP to list Foundry resources in the subscription:
Tool: azure-mcp-foundry
Command: foundry_resource_get
Parameters:
subscription: <subscription-id-from-step-1>
This returns all AIServices resources with their endpoints and deployed models.
Step 3: List Agents in a Project
Once you have the resource endpoint, list available agents:
Tool: azure-mcp-foundry
Command: foundry_agents_list
Parameters:
endpoint: https://<resource-name>.services.ai.azure.com/api/projects/<project-name>
Note: The endpoint format for agents uses .services.ai.azure.com (not .cognitiveservices.azure.com).
Step 4: Invoke an Agent
Connect to and query a specific agent:
Tool: azure-mcp-foundry
Command: foundry_agents_connect
Parameters:
agent-id: <agent-id-from-step-3>
endpoint: https://<resource-name>.services.ai.azure.com/api/projects/<project-name>
query: <user-message>
Example: Task Priority Classification
For the priority-detection-agent:
Input: "Create a new PO for new supplies"
Output:
{
"priority": "MEDIUM",
"reasoning": "Creating a purchase order for new supplies is an important task that supports ongoing operations. While it should be addressed promptly, it is typically part of planned work and does not constitute an emergency.",
"task_content": "Create a new PO for new supplies"
}
Priority Guidelines
- HIGH: Critical emergencies - production outages, security breaches, system failures, customer-impacting issues
- MEDIUM: Important tasks with reasonable deadlines, planned work, non-critical bugs
- LOW: Nice-to-have improvements, cosmetic changes, tasks marked "when time permits"
Available Commands Reference
| Command | Purpose | Required Parameters |
|---|---|---|
foundry_resource_get |
List Foundry resources | subscription |
foundry_agents_list |
List agents in a project | endpoint |
foundry_agents_connect |
Invoke an agent | agent-id, endpoint, query |
foundry_agents_create |
Create a new agent | See MCP docs |
foundry_threads_list |
List conversation threads | endpoint |
foundry_threads_get-messages |
Get thread messages | endpoint, thread-id |
Error Handling
- Missing subscription: Run
az account showto get current subscription - Authentication failed: Run
az loginto authenticate - Agent not found: Use
foundry_agents_listto verify agent ID - Invalid endpoint: Ensure endpoint uses
.services.ai.azure.com/api/projects/format
Tips
- Cache the subscription ID and endpoint for subsequent calls
- The agent ID from
foundry_agents_list(e.g.,asst_xxx) is used infoundry_agents_connect - Thread IDs from agent responses can be used to continue conversations
- Use
foundry_resource_getwithoutresource-nameto list all resources