$npx -y skills add microsoft/azure-skills --skill presetIntelligently deploys Azure OpenAI models to optimal regions by analyzing capacity across all available regions. Automatically checks current region first and shows alternatives if needed. USE FOR: quick deployment, optimal region, best region, automatic region selection, fast se
| 1 | # Deploy Model to Optimal Region |
| 2 | |
| 3 | Automates intelligent Azure OpenAI model deployment by checking capacity across regions and deploying to the best available option. |
| 4 | |
| 5 | ## What This Skill Does |
| 6 | |
| 7 | 1. Verifies Azure authentication and project scope |
| 8 | 2. Checks capacity in current project's region |
| 9 | 3. If no capacity: analyzes all regions and shows available alternatives |
| 10 | 4. Filters projects by selected region |
| 11 | 5. Supports creating new projects if needed |
| 12 | 6. Deploys model with GlobalStandard SKU |
| 13 | 7. Monitors deployment progress |
| 14 | |
| 15 | ## Prerequisites |
| 16 | |
| 17 | - Azure CLI installed and configured |
| 18 | - Active Azure subscription with Cognitive Services read/create permissions |
| 19 | - Azure AI Foundry project resource ID (`PROJECT_RESOURCE_ID` env var or provided interactively) |
| 20 | - Format: `/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.CognitiveServices/accounts/{account}/projects/{project}` |
| 21 | - Found in: Azure AI Foundry portal → Project → Overview → Resource ID |
| 22 | |
| 23 | ## Quick Workflow |
| 24 | |
| 25 | ### Fast Path (Current Region Has Capacity) |
| 26 | ``` |
| 27 | 1. Check authentication → 2. Get project → 3. Check current region capacity |
| 28 | → 4. Deploy immediately |
| 29 | ``` |
| 30 | |
| 31 | ### Alternative Region Path (No Capacity) |
| 32 | ``` |
| 33 | 1. Check authentication → 2. Get project → 3. Check current region (no capacity) |
| 34 | → 4. Query all regions → 5. Show alternatives → 6. Select region + project |
| 35 | → 7. Deploy |
| 36 | ``` |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## Deployment Phases |
| 41 | |
| 42 | | Phase | Action | Key Commands | |
| 43 | |-------|--------|-------------| |
| 44 | | 1. Verify Auth | Check Azure CLI login and subscription | `az account show`, `az login` | |
| 45 | | 2. Get Project | Parse `PROJECT_RESOURCE_ID` ARM ID, verify exists | `az cognitiveservices account show` | |
| 46 | | 3. Get Model | List available models, user selects model + version | `az cognitiveservices account list-models` | |
| 47 | | 4. Check Current Region | Query capacity using GlobalStandard SKU | `az rest --method GET .../modelCapacities` | |
| 48 | | 5. Multi-Region Query | If no local capacity, query all regions | Same capacity API without location filter | |
| 49 | | 6. Select Region + Project | User picks region; find or create project | `az cognitiveservices account list`, `az cognitiveservices account create` | |
| 50 | | 7. Deploy | Generate unique name, calculate capacity (50% available, min 50 TPM), create deployment | `az cognitiveservices account deployment create` | |
| 51 | |
| 52 | For detailed step-by-step instructions, see [workflow reference](references/workflow.md). |
| 53 | |
| 54 | --- |
| 55 | |
| 56 | ## Error Handling |
| 57 | |
| 58 | | Error | Symptom | Resolution | |
| 59 | |-------|---------|------------| |
| 60 | | Auth failure | `az account show` returns error | Run `az login` then `az account set --subscription <id>` | |
| 61 | | No quota | All regions show 0 capacity | Defer to the [quota skill](../../../quota/quota.md) for increase requests and troubleshooting; check existing deployments; try alternative models | |
| 62 | | Model not found | Empty capacity list | Verify model name with `az cognitiveservices account list-models`; check case sensitivity | |
| 63 | | Name conflict | "deployment already exists" | Append suffix to deployment name (handled automatically by `generate_deployment_name` script) | |
| 64 | | Region unavailable | Region doesn't support model | Select a different region from the available list | |
| 65 | | Permission denied | "Forbidden" or "Unauthorized" | Verify Cognitive Services Contributor role: `az role assignment list --assignee <user>` | |
| 66 | |
| 67 | --- |
| 68 | |
| 69 | ## Advanced Usage |
| 70 | |
| 71 | ```bash |
| 72 | # Custom capacity |
| 73 | az cognitiveservices account deployment create ... --sku-capacity <value> |
| 74 | |
| 75 | # Check deployment status |
| 76 | az cognitiveservices account deployment show --name <acct> --resource-group <rg> --deployment-name <name> --query "{Status:properties.provisioningState}" |
| 77 | |
| 78 | # Delete deployment |
| 79 | az cognitiveservices account deployment delete --name <acct> --resource-group <rg> --deployment-name <name> |
| 80 | ``` |
| 81 | |
| 82 | ## Notes |
| 83 | |
| 84 | - **SKU:** GlobalStandard only — **API Version:** 2024-10-01 (GA stable) |
| 85 | |
| 86 | --- |
| 87 | |
| 88 | ## Related Skills |
| 89 | |
| 90 | - **microsoft-foundry** - Parent skill for Azure AI Foundry operations |
| 91 | - **[quota](../../../quota/quota.md)** — For quota viewing, increase requests, and troubleshooting quota errors, defer to this skill |
| 92 | - **azure-quick-review** - Review Azure resources for compliance |
| 93 | - **azure-cost-estimation** - Estimate costs for Azure deployments |
| 94 | - **azure-validate** - Validate Azure infrastructure before deployment |