$npx -y skills add microsoft/azure-skills --skill capacityDiscovers available Azure OpenAI model capacity across regions and projects. Analyzes quota limits, compares availability, and recommends optimal deployment locations based on capacity requirements. USE FOR: find capacity, check quota, where can I deploy, capacity discovery, best
| 1 | # Capacity Discovery |
| 2 | |
| 3 | Finds available Azure OpenAI model capacity across all accessible regions and projects. Recommends the best deployment location based on capacity requirements. |
| 4 | |
| 5 | ## Quick Reference |
| 6 | |
| 7 | | Property | Description | |
| 8 | |----------|-------------| |
| 9 | | **Purpose** | Find where you can deploy a model with sufficient capacity | |
| 10 | | **Scope** | All regions and projects the user has access to | |
| 11 | | **Output** | Ranked table of regions/projects with available capacity | |
| 12 | | **Action** | Read-only analysis — does NOT deploy. Hands off to preset or customize | |
| 13 | | **Authentication** | Azure CLI (`az login`) | |
| 14 | |
| 15 | ## When to Use This Skill |
| 16 | |
| 17 | - ✅ User asks "where can I deploy gpt-4o?" |
| 18 | - ✅ User specifies a capacity target: "find a region with 10K TPM for gpt-4o" |
| 19 | - ✅ User wants to compare availability: "which regions have gpt-4o available?" |
| 20 | - ✅ User got a quota error and needs to find an alternative location |
| 21 | - ✅ User asks "best region and project for deploying model X" |
| 22 | |
| 23 | **After discovery → hand off to [preset](../preset/SKILL.md) or [customize](../customize/SKILL.md) for actual deployment.** |
| 24 | |
| 25 | ## Scripts |
| 26 | |
| 27 | Pre-built scripts handle the complex REST API calls and data processing. Use these instead of constructing commands manually. |
| 28 | |
| 29 | | Script | Purpose | Usage | |
| 30 | |--------|---------|-------| |
| 31 | | `scripts/discover_and_rank.ps1` | Full discovery: capacity + projects + ranking | Primary script for capacity discovery | |
| 32 | | `scripts/discover_and_rank.sh` | Same as above (bash) | Primary script for capacity discovery | |
| 33 | | `scripts/query_capacity.ps1` | Raw capacity query (no project matching) | Quick capacity check or version listing | |
| 34 | | `scripts/query_capacity.sh` | Same as above (bash) | Quick capacity check or version listing | |
| 35 | |
| 36 | ## Workflow |
| 37 | |
| 38 | ### Phase 1: Validate Prerequisites |
| 39 | |
| 40 | ```bash |
| 41 | az account show --query "{Subscription:name, SubscriptionId:id}" --output table |
| 42 | ``` |
| 43 | |
| 44 | ### Phase 2: Identify Model and Version |
| 45 | |
| 46 | Extract model name from user prompt. If version is unknown, query available versions: |
| 47 | |
| 48 | ```powershell |
| 49 | .\scripts\query_capacity.ps1 -ModelName <model-name> |
| 50 | ``` |
| 51 | ```bash |
| 52 | ./scripts/query_capacity.sh <model-name> |
| 53 | ``` |
| 54 | |
| 55 | This lists available versions. Use the latest version unless user specifies otherwise. |
| 56 | |
| 57 | ### Phase 3: Run Discovery |
| 58 | |
| 59 | Run the full discovery script with model name, version, and minimum capacity target: |
| 60 | |
| 61 | ```powershell |
| 62 | .\scripts\discover_and_rank.ps1 -ModelName <model-name> -ModelVersion <version> -MinCapacity <target> |
| 63 | ``` |
| 64 | ```bash |
| 65 | ./scripts/discover_and_rank.sh <model-name> <version> <min-capacity> |
| 66 | ``` |
| 67 | |
| 68 | > 💡 The script automatically queries capacity across ALL regions, cross-references with the user's existing projects, and outputs a ranked table sorted by: meets target → project count → available capacity. |
| 69 | |
| 70 | ### Phase 3.5: Validate Subscription Quota |
| 71 | |
| 72 | After discovery identifies candidate regions, validate that the user's subscription actually has available quota in each region. Model capacity (from Phase 3) shows what the platform can support, but subscription quota limits what this specific user can deploy. |
| 73 | |
| 74 | ```powershell |
| 75 | # For each candidate region from discovery results: |
| 76 | $usageData = az cognitiveservices usage list --location <region> --subscription $SUBSCRIPTION_ID -o json 2>$null | ConvertFrom-Json |
| 77 | |
| 78 | # Check quota for each SKU the model supports |
| 79 | # Quota names follow pattern: OpenAI.<SKU>.<model-name> |
| 80 | $usageEntry = $usageData | Where-Object { $_.name.value -eq "OpenAI.<SKU>.<model-name>" } |
| 81 | |
| 82 | if ($usageEntry) { |
| 83 | $quotaAvailable = $usageEntry.limit - $usageEntry.currentValue |
| 84 | } else { |
| 85 | $quotaAvailable = 0 # No quota allocated |
| 86 | } |
| 87 | ``` |
| 88 | ```bash |
| 89 | # For each candidate region from discovery results: |
| 90 | usage_json=$(az cognitiveservices usage list --location <region> --subscription "$SUBSCRIPTION_ID" -o json 2>/dev/null) |
| 91 | |
| 92 | # Extract quota for specific SKU+model |
| 93 | quota_available=$(echo "$usage_json" | jq -r --arg name "OpenAI.<SKU>.<model-name>" \ |
| 94 | '.[] | select(.name.value == $name) | .limit - .currentValue') |
| 95 | ``` |
| 96 | |
| 97 | **Annotate discovery results:** |
| 98 | |
| 99 | Add a "Quota Available" column to the ranked output from Phase 3: |
| 100 | |
| 101 | | Region | Available Capacity | Meets Target | Projects | Quota Available | |
| 102 | |--------|-------------------|--------------|----------|-----------------| |
| 103 | | eastus2 | 120K TPM | ✅ | 3 | ✅ 80K | |
| 104 | | westus3 | 90K TPM | ✅ | 1 | ❌ 0 (at limit) | |
| 105 | | swedencentral | 100K TP |