/aigateway:manage-ai-gatewayfrom aigateway
Administers Microsoft.ApiManagement/aigateways resources using the Azure AI Gateway CLI. Manages providers, models, aliases, MCP sources, policies, client keys, managed identities, networking, private endpoint connections, and telemetry.
Ships in aigateway. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Manage Microsoft.ApiManagement/aigateways resources (default workspace) with az aigateway (or az aig). Never use az rest or target legacy Microsoft.ApiManagement/service; migrating an existing APIM workload is outside this skill, so do not read, convert, or replicate source APIM configuration here. External resources must already exist; only RBAC role assignments required for gateway operation may be created via az role assignment create after confirmation.
Discover missing context with Azure CLI before asking the user. Ask only when multiple candidates match or external values (new gateway region, custom URL, or secret) cannot be discovered.
az aigateway version. If missing, ask approval to install via curl -fsSL https://aka.ms/aigateway-cli-install | bash (cli/install.ps1 on Windows).SUB from user input or az account show --query id -o tsv. Pass --subscription "$SUB" on every command so name-based commands do not fall back to the default subscription.az aigateway list --subscription "$SUB" [-g "$RG"] -o json, filtering type == "Microsoft.ApiManagement/aigateways"), Foundry accounts/deployments (az cognitiveservices account list / deployment list), identities (az identity list), subnets (az network vnet subnet list), or Application Insights (az resource show).SUB="<subscription-id>"
RG="<resource-group>"
GW="<gateway-name>"
GATEWAY_ID="/subscriptions/$SUB/resourceGroups/$RG/providers/Microsoft.ApiManagement/aigateways/$GW"
| Target resource | Selector flags (always include --subscription "$SUB") |
|---|---|
Gateway (create, show, update, delete, wait), identity, network | -g "$RG" -n "$GW" (or --ids "$GATEWAY_ID", except on create and identity) |
Workspace children (model-provider, model-alias, mcp, api-key, telemetry-exporter, network private-endpoint-connection) | -g "$RG" --gateway-name "$GW" -n "<child-name>" (telemetry-exporter has no --ids) |
Workspace policies (policy) | -g "$RG" --gateway-name "$GW" |
Provider children (model, model policy) | -g "$RG" --gateway-name "$GW" --provider-name "$PROVIDER" -n "$MODEL" |
MCP sources (mcp source) | -g "$RG" --gateway-name "$GW" --tool-server-name "$MCP_NAME" [--namespace "$NS"] |
Check az aigateway list --subscription "$SUB" -g "$RG" -o json first to avoid overwriting an existing gateway.
az aigateway create --subscription "$SUB" -g "$RG" -n "$GW" --location "$LOCATION" \
[--system-assigned true] [--subnet "$SUBNET_ID"] [--tags env=prod]
az aigateway update --ids "$GATEWAY_ID" --subscription "$SUB" [--tags @tags.json] [--sku Standard]
az aigateway delete --ids "$GATEWAY_ID" --subscription "$SUB" --yes
--sku defaults to Standard. --user-assigned is rejected on create; attach UAMIs afterwards with az aigateway identity assign.properties.gatewayUrl (or properties.frontend.defaultHostname).--tags replaces all tags—merge existing tags from show first. delete leaves a soft-delete record (az apim deletedservice purge --service-name "$GW" --location "$LOCATION" only if permanent purge is requested).--no-wait polling.model-provider, model, model-alias)Clients call model aliases (properties.aliasName, set via --routing-name), never provider or model registration names.
# Onboard one Foundry deployment (enables system MI, grants Foundry User on account, creates/reuses provider + model)
az aigateway model create --subscription "$SUB" -g "$RG" --gateway-name "$GW" \
--foundry-resource-id "$FOUNDRY_ACCOUNT_ID" --deployment "$DEPLOYMENT_NAME"
# Register a Foundry provider only (enables system MI and grants Foundry User by default, without importing deployments)
az aigateway model-provider create --subscription "$SUB" -g "$RG" --gateway-name "$GW" \
--foundry-resource-id "$FOUNDRY_ACCOUNT_ID"
# Bulk-onboard all deployments in a Foundry account
az aigateway model-provider import --subscription "$SUB" -g "$RG" --gateway-name "$GW" \
--foundry-resource-id "$FOUNDRY_ACCOUNT_ID"
# Reconcile Foundry provider with current deployments (preview first; apply deletes stale unaliased models)
az aigateway model-provider sync --subscription "$SUB" -g "$RG" --gateway-name "$GW" \
-n "$PROVIDER" --create-default-aliases --dry-run
# Custom or low-level provider + model
az aigateway model-provider create --subscription "$SUB" -g "$RG" --gateway-name "$GW" -n "$PROVIDER" --kind Custom --custom @custom.json
az aigateway model create --subscription "$SUB" -g "$RG" --gateway-name "$GW" --provider-name "$PROVIDER" -n "$MODEL" \
--deployment-config '{"modelName":"<backend-model>"}' --api-format OpenAIChatCompletions --supported-endpoints /v1/chat/completions
# Create 1:1 default aliases for all models in a provider
az aigateway model list --subscription "$SUB" -g "$RG" --gateway-name "$GW" --provider-name "$PROVIDER" -o json \
| az aigateway model-alias create
# Create or update an alias (`set` upserts; `create` fails if the alias exists)
az aigateway model-alias set --subscription "$SUB" -g "$RG" --gateway-name "$GW" -n "$ALIAS" --routing-name "$ROUTING_NAME" \
--backend-model resource-id="$MODEL_A_ID" priority=0 weight=80 \
--backend-model resource-id="$MODEL_B_ID" priority=0 weight=20 \
--backend-model resource-id="$FALLBACK_MODEL_ID" priority=1 weight=100
See references/models-and-routing.md for low-level Foundry/Custom JSON schemas, --api-format and update flags, alias pool routing rules, and safe deletion order.
mcp, mcp source)Clients call <gatewayUrl>/default/toolservers/<mcp-name>/mcp. Each source's namespace prefixes its tools as <namespace>_<tool>.
az aigateway mcp create --subscription "$SUB" -g "$RG" --gateway-name "$GW" -n "$MCP_NAME" \
--endpoints '[{"kind":"mcp","namespace":"learn","required":true,"mcp":{"transport":"streamableHttp","url":"https://learn.microsoft.com/api/mcp"},"credentials":{"type":"none"}}]'
az aigateway mcp source add --subscription "$SUB" -g "$RG" --gateway-name "$GW" --tool-server-name "$MCP_NAME" \
--namespace "$NS" --kind mcp --mcp '{"transport":"streamableHttp","url":"https://tools.example.com/mcp"}' \
--credentials '{"type":"none"}' --required true
az aigateway mcp source remove --subscription "$SUB" -g "$RG" --gateway-name "$GW" --tool-server-name "$MCP_NAME" --namespace "$NS"
See references/mcp.md for OpenAPI/credential JSON schemas, editing existing sources (mcp update --endpoints), OAuth (mcp authorize), and tool filtering (allowList, blocked).
policy, model policy, --policies)| Host | Read | Write | Supported type values |
|---|---|---|---|
Workspace (default) | policy list | policy set, set-token-limit, set-cost-limit, set-rate-limit, set-ip-filter, remove | tokenLimit, costLimit, requestRateLimit, ipFilter |
| Model | model policy list | model policy set, set-token-limit, set-cost-limit, remove, or model update --policies @file | tokenLimit, costLimit, requestRateLimit, ipFilter |
| Alias | model-alias show | model-alias update --policies @file | tokenLimit, costLimit, requestRateLimit, ipFilter |
| MCP ToolServer | mcp show | mcp update --policies @file | requestRateLimit, ipFilter, toolThreatProtection, agentHooks |
az aigateway policy set-token-limit --subscription "$SUB" -g "$RG" --gateway-name "$GW" --token-limit 30000 --token-period minute --token-counter-key Identity
az aigateway policy set-cost-limit --subscription "$SUB" -g "$RG" --gateway-name "$GW" --amount 100 --period month --cost-counter-key Identity
az aigateway policy set-rate-limit --subscription "$SUB" -g "$RG" --gateway-name "$GW" --rate-limit 60 --rate-period minute --rate-counter-key Identity
az aigateway policy set-ip-filter --subscription "$SUB" -g "$RG" --gateway-name "$GW" --ip-filter-mode Allow --ip-addresses 203.0.113.0/24
az aigateway policy remove --subscription "$SUB" -g "$RG" --gateway-name "$GW" --remove-token-limit true
set-content-safety) is unsupported on Microsoft.ApiManagement/aigateways (legacy service only).policy show; use policy list). --policies @file on model, model-alias, or mcp update replaces the entire properties.policies array—read existing policies first and preserve other entries and id values.counterKey / scope values and JSON schemas (costLimit overrides, toolThreatProtection, agentHooks).identity, api-key)az aigateway identity show --subscription "$SUB" -g "$RG" -n "$GW" -o json
az aigateway identity assign --subscription "$SUB" -g "$RG" -n "$GW" --system-assigned true
az aigateway identity assign --subscription "$SUB" -g "$RG" -n "$GW" --user-assigned "$UAMI_RESOURCE_ID"
az aigateway identity remove --subscription "$SUB" -g "$RG" -n "$GW" --user-assigned "$UAMI_RESOURCE_ID"
az aigateway api-key list --subscription "$SUB" -g "$RG" --gateway-name "$GW" -o json
az aigateway api-key create --subscription "$SUB" -g "$RG" --gateway-name "$GW" -n "$KEY_NAME"
az aigateway api-key update --subscription "$SUB" -g "$RG" --gateway-name "$GW" -n "$KEY_NAME" --state suspended
identity show exits with not-found if no identity is assigned yet. See references/keys-and-identities.md for UAMI identifier mapping (id vs clientId vs principalId), inbound/outbound RBAC role IDs and az role assignment commands, secret retrieval (list-secrets), and staged key rotation (regenerate).
network)az aigateway network show --subscription "$SUB" -g "$RG" -n "$GW" -o json
az aigateway network update --subscription "$SUB" -g "$RG" -n "$GW" --subnet "$SUBNET_ID"
az aigateway network update --subscription "$SUB" -g "$RG" -n "$GW" --disable-vnet-integration true
az aigateway network private-endpoint-connection list --subscription "$SUB" -g "$RG" --gateway-name "$GW" -o json
--subnet and --disable-vnet-integration are mutually exclusive. See references/networking.md for delegated subnet requirements and private endpoint connection commands (show, approve, reject, delete, wait).
telemetry-exporter)az aigateway telemetry-exporter list --subscription "$SUB" -g "$RG" --gateway-name "$GW" -o json
az aigateway telemetry-exporter create --subscription "$SUB" -g "$RG" --gateway-name "$GW" \
-n "$EXPORTER" --kind OpenTelemetry --open-telemetry @otlp.json \
[--application-insights "{\"resourceId\":\"$APPINSIGHTS_ID\"}"] --payload-capture false
See references/telemetry-and-troubleshooting.md for Application Insights OTLP/DCR discovery, otlp.json schemas, claim attribute mappings, and troubleshooting (there is no telemetry-exporter wait; verify with telemetry-exporter show).
--foundry-resource-id onboarding directly. Ask confirmation before:
delete) or applying model-provider sync when --dry-run plans deletions.--backend-model, --endpoints, --policies, --tags, telemetry attributes) or weakening security policies.az role assignment create commands.api-key list-secrets, mcp authorize), changing network/private-endpoint access, or enabling --payload-capture true.0600 JSON files outside source control (@file.json does not expand $ENV_VAR). Never send redacted markers in updates.show/list to confirm target fields and preserved sibling settings. The CLI has no subcommands for model inference, MCP tools/list / tools/call, or KQL log queries; verify runtime traffic separately with an authorized HTTP/MCP client or az monitor query.references/gateway-lifecycle.md (opens in a new tab)references/keys-and-identities.md (opens in a new tab)references/mcp.md (opens in a new tab)references/models-and-routing.md (opens in a new tab)references/networking.md (opens in a new tab)references/policies.md (opens in a new tab)references/telemetry-and-troubleshooting.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
4 skills in this plugin
/feedback-ai-gatewayCollect Azure AI Gateway session feedback on friction points and completed work. Process session summaries to extract insights: where users struggled, what was accomplished, and outcomes. Scrub sensitive identifiers and return a clean file ready for product feedback or bug reports./migrate-apimMigrate AI workloads from Azure API Management to Azure AI Gateway. Use when asked to inventory, assess, plan, or execute a move of model APIs, MCP servers, or A2A agents from an APIM instance to Microsoft.ApiManagement/aigateways./use-ai-gatewayDiscover callable Azure AI Gateway model and MCP endpoints, then connect them to an existing app or developer workflow.npx claudepluginhub azure/aigateway --plugin aigatewayOther plugins' skills for the same job