Foundry Agent Sync
GitHubOfficialFirst committed by onsenturkDistributed by GitHub
- Skill
- Workflow
- Cloud and DevOps
- MIT
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured workflow for registering and updating AI agents directly within an Azure AI Foundry project. By utilizing a local JSON manifest, developers can maintain agent definitions as code and push them to the Foundry service via the Agent Service REST API. This ensures that agents are consistently deployed, versioned, and ready for invocation, evaluation, or management within the Foundry environment.
What it does
- Scaffolds a JSON manifest for defining multiple AI agents.
- Provides a PowerShell script to automate the registration of agents in Azure AI Foundry.
- Supports idempotent updates to existing agents via REST API calls.
- Integrates with CI/CD pipelines using Bicep deployment scripts.
- Enables verification of synced agents through direct API queries.
When to use it
- When you need to register or update AI agents in Azure AI Foundry from a local repository.
- When managing multiple agent configurations as code.
- When automating agent deployment within infrastructure-as-code workflows.
- When you need to ensure consistent agent instructions across development and production environments.
Advantages
- Enables version control for agent instructions and metadata.
- Automates the registration process, reducing manual configuration in the Foundry portal.
- Supports idempotent deployments to prevent duplicate or conflicting agent entries.
- Integrates seamlessly with existing Azure CLI and Bicep infrastructure workflows.
Usage examples
- “Create a new foundry agent manifest for my project.”
- The agent will generate a JSON file structure in your repository to define your agent's use case, description, and system instructions.
- “Sync my local agents to Azure AI Foundry.”
- The agent will guide you through executing the sync script, using your provided project endpoint and subscription details to register the agents defined in your manifest.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/github/foundry-agent-sync/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip foundry-agent-sync.zip -d .agents/skills
Documentation by onsenturk
Foundry Agent Sync
Overview
Create and synchronize prompt-based AI agents directly within Azure AI Foundry via the Agent Service REST API. This skill registers agents in the Foundry service itself — making them immediately available for invocation, evaluation, and management through the Foundry portal or API. Each agent is created or updated idempotently via a named POST call, using definitions from a local JSON manifest file.
Key distinction: This skill creates agents inside AI Foundry (server-side). It does not scaffold local agent code or container images — for that, use the
microsoft-foundryskill'screatesub-skill.
Prerequisites
The user must have:
An Azure AI Foundry project with a deployed model (e.g.
gpt-5-4)Azure CLI (
az) authenticated with access to the Foundry projectThe Azure AI User role (or higher) on the Foundry project resource
Collect these values before proceeding:
| Value | How to get it |
|---|---|
| Foundry project endpoint | Azure Portal → AI Foundry project → Overview → Endpoint, or az resource show |
| Subscription ID | az account show --query id -o tsv |
| Model deployment name | The model name deployed in the Foundry project (e.g. gpt-5-4) |
Manifest Format
The manifest is a JSON array where each entry defines one agent. Look for it at common paths: infra/foundry-agents.json, foundry-agents.json, or .foundry/agents.json. If none exists, scaffold one.
[
{
"useCaseId": "alert-triage",
"description": "Short description of what this agent does.",
"baseInstruction": "You are an assistant that... <system prompt for the agent>"
}
]Field Reference
| Field | Required | Description |
|---|---|---|
useCaseId | Yes | Kebab-case identifier; used to build the agent name ({prefix}-{useCaseId}) |
description | Yes | Human-readable description stored as agent metadata |
baseInstruction | Yes | System prompt / base instructions for the agent |
Sync Script
PowerShell (interactive / CI)
Create or locate the sync script. The canonical path is infra/scripts/sync-foundry-agents.ps1 but adapt to the repo layout.
param(
[Parameter(Mandatory)]
[string]$SubscriptionId,
[Parameter(Mandatory)]
[string]$ProjectEndpoint,
[string]$ManifestPath = (Join-Path $PSScriptRoot '..\foundry-agents.json'),
[string]$ModelName = 'gpt-5-4',
[string]$AgentNamePrefix = 'myproject',
[string]$ApiVersion = '2025-11-15-preview'
)
$ErrorActionPreference = 'Stop'
# Optional: append a common instruction suffix to every agent
$commonSuffix = ''
az account set --subscription $SubscriptionId | Out-Null
$accessToken = az account get-access-token --resource https://ai.azure.com/ --query accessToken -o tsv
if (-not $accessToken) { throw 'Failed to acquire Foundry access token.' }
$definitions = Get-Content -Raw -Path $ManifestPath | ConvertFrom-Json
$headers = @{ Authorization = "Bearer $accessToken" }
$results = @()
foreach ($def in $definitions) {
$agentName = "$AgentNamePrefix-$($def.useCaseId)"
$instructions = if ($commonSuffix) { "$($def.baseInstruction)`n`n$commonSuffix" } else { $def.baseInstruction }
$body = @{
definition = @{ kind = 'prompt'; model = $ModelName; instructions = $instructions }
description = $def.description
metadata = @{ useCaseId = $def.useCaseId; managedBy = 'foundry-agent-sync' }
} | ConvertTo-Json -Depth 8
$uri = "$($ProjectEndpoint.TrimEnd('/'))/agents/$agentName`?api-version=$ApiVersion"
$resp = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -ContentType 'application/json' -Body $body
$version = $resp.version ?? $resp.latest_version ?? $resp.id ?? 'unknown'
Write-Host "Synced $agentName ($version)"
$results += [pscustomobject]@{ name = $agentName; version = $version }
}
$results | Format-Table -AutoSizeBash (Bicep deployment script / CI)
For automated deployment via Microsoft.Resources/deploymentScripts, use a bash script that:
Authenticates with a managed identity:
az login --identity --username "$CLIENT_ID"Acquires a Foundry token:
az account get-access-token --resource https://ai.azure.com/Iterates definitions from the
FOUNDRY_AGENT_DEFINITIONSenvironment variable (JSON string)POSTs each agent to
{endpoint}/agents/{name}?api-version=2025-11-15-preview
Bicep Integration (optional)
To run the sync automatically during infrastructure deployment:
Load the manifest at compile time:
var agentDefinitions = loadJsonContent('foundry-agents.json')Create a User-Assigned Managed Identity with the Azure AI User role on the Foundry project.
Create a
Microsoft.Resources/deploymentScriptsresource (kindAzureCLI) that:Uses the managed identity
Loads the bash sync script via
loadTextContentPasses the project endpoint, definitions, and model as environment variables
Gate behind a deployFoundryAgents parameter so teams can opt in/out.
Workflow
Step 1 — Locate or scaffold the manifest
Search the repo for foundry-agents.json. If it doesn't exist, ask the user what agents they need and create the manifest.
Step 2 — Locate or scaffold the sync script
Search for sync-foundry-agents.ps1 or foundry-agent-sync.sh. If missing, create the PowerShell script using the template above, adapting:
$AgentNamePrefixto match the project name$ModelNameto the user's deployed model$ManifestPathto the actual manifest location
Step 3 — Collect parameters
Ask the user for:
Foundry project endpoint
Subscription ID
Model deployment name (default:
gpt-5-4)Agent name prefix (default: repo name in kebab-case)
Step 4 — Run the sync
Execute the PowerShell script with the collected parameters:
.\infra\scripts\sync-foundry-agents.ps1 `
-SubscriptionId '<sub-id>' `
-ProjectEndpoint '<endpoint>' `
-ModelName '<model>' `
-AgentNamePrefix '<prefix>'Step 5 — Verify
Confirm synced agents by listing them:
$token = az account get-access-token --resource https://ai.azure.com/ --query accessToken -o tsv
$endpoint = '<project-endpoint>'
Invoke-RestMethod -Uri "$endpoint/agents?api-version=2025-11-15-preview" `
-Headers @{ Authorization = "Bearer $token" }REST API Reference
| Operation | Method | URL |
|---|---|---|
| Create/update agent | POST | {projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview |
| List agents | GET | {projectEndpoint}/agents?api-version=2025-11-15-preview |
| Get agent | GET | {projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview |
| Delete agent | DELETE | {projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview |
Create/Update Payload
{
"definition": {
"kind": "prompt",
"model": "<deployed-model-name>",
"instructions": "<system prompt>"
},
"description": "<agent description>",
"metadata": {
"useCaseId": "<use-case-id>",
"managedBy": "foundry-agent-sync"
}
}Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized | Token expired or wrong audience | Re-run az account get-access-token --resource https://ai.azure.com/ |
403 Forbidden | Missing Azure AI User role | Assign the role on the Foundry project scope |
404 Not Found | Wrong project endpoint | Verify endpoint includes /api/projects/{projectName} |
| Model not found | Model not deployed in project | Deploy the model in AI Foundry portal first |
| Empty definitions | Manifest path wrong | Check -ManifestPath points to the JSON file |
Files
- ATTRIBUTION.mdAdded by AutoGineer871 B
- LICENSELicence file added by AutoGineer1.0 KiB
- SKILL.md8.2 KiB
ATTRIBUTION.md
Attribution
This folder is an unmodified copy of the Agent Skill "foundry-agent-sync", distributed by AutoGineer (https://autogineer.com/agent-skills).
Commit: 797337f33f73e35d08d82f840e21c4b8c4932d88
First committed by: onsenturk (https://github.com/onsenturk)
Publisher: GitHub (https://github.com/github)
Licence: MIT License (https://github.com/github/awesome-copilot/blob/797337f33f73e35d08d82f840e21c4b8c4932d88/LICENSE)
Licence evidence: repository licence LICENSE
Retrieved: 2026-11-07
The skill's own files are unmodified copies. AutoGineer is not affiliated with or endorsed by the author or the publisher.
Files added by AutoGineer
ATTRIBUTION.md: this file, written by AutoGineer
LICENSE: copied from LICENSE
Requirements and compatibility
Written for: GitHub Copilot
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs a command-line tool
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- First committed by
onsenturk
- Publisher
- GitHub (Official)
- Distributed by
- GitHub
- Source
- github/awesome-copilot · skills/foundry-agent-sync · commit 797337f
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Contributors
- onsenturk
AutoGineer is not affiliated with or endorsed by onsenturk or GitHub.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download foundry-agent-sync.zip