azure-aigateway

द्वारा Azure

Azure API Management (APIM) को AI गेटवे के रूप में कॉन्फ़िगर करें ताकि AI मॉडल, MCP सर्वर और एजेंट को सुरक्षित, निगरानी और नियंत्रित किया जा सके। दर सीमित करने, सिमैंटिक कैशिंग, सामग्री सुरक्षा और लोड बैलेंसिंग में सहायता करता है।

npx skills add https://github.com/microsoft/GitHub-Copilot-for-Azure --skill azure-aigateway

Azure AI Gateway

Configure Azure API Management (APIM) as an AI Gateway for governing AI models, MCP tools, and agents.

To deploy APIM, use the azure-prepare skill. See APIM deployment guide.

When to Use This Skill

CategoryTriggers
Model Governance"semantic caching", "token limits", "load balance AI", "track token usage"
Tool Governance"rate limit MCP", "protect my tools", "configure my tool", "convert API to MCP"
Agent Governance"content safety", "jailbreak detection", "filter harmful content"
Configuration"add Azure OpenAI backend", "configure my model", "add AI Foundry model"
Testing"test AI gateway", "call OpenAI through gateway"

Quick Reference

PolicyPurposeDetails
azure-openai-token-limitCost controlModel Policies
azure-openai-semantic-cache-lookup/store60-80% cost savingsModel Policies
azure-openai-emit-token-metricObservabilityModel Policies
llm-content-safetySafety & complianceAgent Policies
rate-limit-by-keyMCP/tool protectionTool Policies

Get Gateway Details

# Get gateway URL
az apim show --name <apim-name> --resource-group <rg> --query "gatewayUrl" -o tsv

# List backends (AI models)
az apim backend list --service-name <apim-name> --resource-group <rg> \
  --query "[].{id:name, url:url}" -o table

# Get subscription key
az apim subscription keys list \
  --service-name <apim-name> --resource-group <rg> --subscription-id <sub-id>

Test AI Endpoint

GATEWAY_URL=$(az apim show --name <apim-name> --resource-group <rg> --query "gatewayUrl" -o tsv)

curl -X POST "${GATEWAY_URL}/openai/deployments/<deployment>/chat/completions?api-version=2024-02-01" \
  -H "Content-Type: application/json" \
  -H "Ocp-Apim-Subscription-Key: <key>" \
  -d '{"messages": [{"role": "user", "content": "Hello"}], "max_tokens": 100}'

Common Tasks

Add AI Backend

See references/patterns.md for full steps.

# Discover AI resources
az cognitiveservices account list --query "[?kind=='OpenAI']" -o table

# Create backend
az apim backend create --service-name <apim> --resource-group <rg> \
  --backend-id openai-backend --protocol http --url "https://<aoai>.openai.azure.com/openai"

# Grant access (managed identity)
az role assignment create --assignee <apim-principal-id> \
  --role "Cognitive Services User" --scope <aoai-resource-id>

Apply AI Governance Policy

Recommended policy order in <inbound>:

  1. Authentication - Managed identity to backend
  2. Semantic Cache Lookup - Check cache before calling AI
  3. Token Limits - Cost control
  4. Content Safety - Filter harmful content
  5. Backend Selection - Load balancing
  6. Metrics - Token usage tracking

See references/policies.md for complete example.


Troubleshooting

IssueSolution
Token limit 429Increase tokens-per-minute or add load balancing
No cache hitsLower score-threshold to 0.7
Content false positivesIncrease category thresholds (5-6)
Backend auth 401Grant APIM "Cognitive Services User" role

See references/troubleshooting.md for details.


References

SDK Quick References

Azure की और Skills

azure-ai
Azure
Azure AI के लिए उपयोग करें: खोज, वाक्, OpenAI, दस्तावेज़ बुद्धिमत्ता। खोज, वेक्टर/हाइब्रिड खोज, वाक्-से-पाठ, पाठ-से-वाक्, प्रतिलेखन, OCR में सहायता करता है।
appinsights-instrumentation
Azure
Azure Application Insights के साथ वेबऐप को इंस्ट्रूमेंट करने के लिए मार्गदर्शन। टेलीमेट्री पैटर्न, SDK सेटअप और कॉन्फ़िगरेशन संदर्भ प्रदान करता है।
azure-compliance
Azure
Azure अनुपालन और सुरक्षा ऑडिटिंग क्षमताएं, जिसमें सर्वोत्तम प्रथाओं का मूल्यांकन, Key Vault समाप्ति निगरानी, और संसाधन कॉन्फ़िगरेशन सत्यापन शामिल हैं।
azure-compute
Azure
कार्यभार आवश्यकताओं, प्रदर्शन आवश्यकताओं और बजट सीमाओं के आधार पर Azure VM आकार, VM स्केल सेट (VMSS) और कॉन्फ़िगरेशन की अनुशंसा करें।
azure-cost-optimization
Azure
Azure सब्सक्रिप्शन में वास्तविक लागतों, उपयोग मीट्रिक्स का विश्लेषण करके और कार्रवाई योग्य अनुकूलन अनुशंसाएँ उत्पन्न करके लागत बचत की पहचान और मात्रा निर्धारित करें।
azure-deploy
Azure
Azure में डिप्लॉयमेंट निष्पादित करें। तैयारी और सत्यापन के बाद अंतिम चरण। azd up, azd deploy, या इंफ्रास्ट्रक्चर प्रोविज़निंग कमांड चलाता है।
azure-diagnostics
Azure
Azure पर उत्पादन समस्याओं का डीबग और समस्या निवारण करें। इसमें कंटेनर ऐप्स और फंक्शन ऐप्स डायग्नोस्टिक्स, KQL के साथ लॉग विश्लेषण, स्वास्थ्य जांच और सामान्य समस्या समाधान शामिल हैं।
azure-hosted-copilot-sdk
Azure
Azure पर GitHub Copilot SDK ऐप्स बनाएं और तैनात करें।