All skills
microsoft avatar

/microsoft-foundry

@04110d9
by microsoftmicrosoft/skills3.1k stars
351

Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, create agent, update agent, add tool to agent, invoke agent, agent.yaml, agent insights, pull agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, prompt optimizer, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure-prepare).

Use this Skill: https://skilld.dev/gh/microsoft/skills/microsoft-foundry

This session only. Nothing lands on disk.

foundry-agenttoolboxreferencestool-mcp-custom-oauth-azure-starter.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

BYO OAuth2 — Azure-hosted MCP starter (build your own MCP on Functions)

Companion to tool-mcp-custom-oauth.md. Use this when you want to build the MCP server yourself on Azure Functions (rather than register an OAuth app against a third-party MCP). Deploying the sample template creates the Function App and its Entra app registration, so four of the five BYO OAuth2 connection inputs come straight from its outputs — you only add a client secret.

Run the steps in order. They set env vars (FUNC, RG, APPID, IDURI, TENANT) that later steps reuse. Then return to tool-mcp-custom-oauth.md § A. Imperative CLI with the inputs.

Step 1 — Scaffold and provision the Function App + Entra app.

azd init --template remote-mcp-functions-python -e mcpserver-python
azd env set AZURE_SUBSCRIPTION_ID <sub-id>
azd env set AZURE_LOCATION <region>       # e.g. eastus2
azd env set VNET_ENABLED false            # public endpoint (simplest); true for private networking
azd up --no-prompt

Step 2 — Capture the outputs into shell vars (used by every step below):

FUNC=$(azd env get-values  | grep AZURE_FUNCTION_NAME   | cut -d'"' -f2)
APPID=$(azd env get-values | grep ENTRA_APPLICATION_ID  | cut -d'"' -f2)
IDURI=$(azd env get-values | grep ENTRA_IDENTIFIER_URI  | cut -d'"' -f2)
TENANT=$(azd env get-values | grep AZURE_TENANT_ID      | cut -d'"' -f2)
RG="rg-$(azd env get-values | grep AZURE_ENV_NAME       | cut -d'"' -f2)"   # template puts resources in rg-<env-name>

Step 3 — Deploy the MCP tool code. azd up provisions infra only — the sample repo's azure.yaml has no services: mapping, so the Function App starts empty and tools/list would return HTTP_404. Publish one of the sample projects:

(cd src/FunctionsMcpTool && func azure functionapp publish "$FUNC")   # one of 4 sample projects

Step 4 — Let the MCP's Easy Auth advertise its scope. Without this the connector's token is rejected with HTTP_403 even after consent:

az functionapp config appsettings set --name "$FUNC" --resource-group "$RG" \
  --settings "WEBSITE_AUTH_PRM_DEFAULT_WITH_SCOPES=$IDURI/user_impersonation"

The template already sets the Function App's allowedAudiences to $IDURI and allowedApplications to $APPID — the same client-id the connection uses — so the token validates.

Step 5 — (optional) Confirm the scope the server advertises matches what you'll pass as --scopes:

curl -s "https://$FUNC.azurewebsites.net/.well-known/oauth-protected-resource"
# => {"resource":"...","scopes_supported":["api://<identifier-uri>/user_impersonation"]}

Step 6 — Create a client secret on the Entra app (it lives on the connection, not the toolbox):

SECRET=$(az ad app credential reset --id "$APPID" --display-name toolbox-oauth2 --years 1 --query password -o tsv)
#   ⚠️ the command prints a WARNING line before the secret — take the LAST line if capturing text.

You now have all five connection inputs:

Connection input Value
--client-id $APPID
--client-secret $SECRET
--authorization-url https://login.microsoftonline.com/$TENANT/oauth2/v2.0/authorize
--token-url https://login.microsoftonline.com/$TENANT/oauth2/v2.0/token
--scopes $IDURI/user_impersonation

The connection target is https://$FUNC.azurewebsites.net/runtime/webhooks/mcp. Next: create the connection (tool-mcp-custom-oauth.md § A), then Set the connector redirect URI. Tear down with azd down --purge (and az ad app delete --id "$APPID") when done.

References

Source: SKILL.md on GitHub

2 warnings3d4 checks · Risk SAFE
  • Gen Agent Trust Hub3d

    This skill provides a comprehensive environment for managing the end-to-end lifecycle of AI agents, models, and infrastructure on Microsoft Foundry. It includes sub-skills for deployment, evaluation, fine-tuning, and troubleshooting. The skill utilizes dynamic code execution and shell command wrappers, which are used within the context of local development and cloud orchestration. All external resources and dependencies originate from trusted organizations and well-known services.

  • Socket3d

    2 alerts: gptSecurity, gptAnomaly

  • Snyk3d

    Risk: LOW · No issues

  • Runlayer7mo

    36/36 files flagged

Signed by skilld at 04110d9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last week
metadata
{
  "author": "Microsoft",
  "version": "1.2.26"
}

README badge

README badge for microsoft/skills/microsoft-foundry