选项

通过检查各区域的容量并部署到最佳可用选项,自动化 Azure OpenAI 模型的部署。

...展开全部
1
更新时间 2026-09-19

将模型部署至最优区域

通过检查各区域的容量并部署到最佳可用选项,自动化智能 Azure OpenAI 模型部署过程。

此技能的功能

  1. 验证 Azure 身份验证和项目范围
  2. 检查当前项目所在区域的容量
  3. 若无容量:分析所有区域并显示可用的替代方案
  4. 按选定区域筛选项目
  5. 支持在需要时创建新项目
  6. 使用 GlobalStandard SKU 部署模型
  7. 监控部署进度

前提条件

  • 已安装并配置 Azure CLI
  • 拥有认知服务读取/创建权限的活跃 Azure 订阅
  • Azure AI Foundry 项目资源 ID(PROJECT_RESOURCE_ID 环境变量或交互式提供)
    • 格式:/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.CognitiveServices/accounts/{account}/projects/{project}
    • 查找位置:Azure AI Foundry 门户 → 项目 → 概述 → 资源 ID

快速工作流

快速路径(当前区域有容量)

1. 检查身份验证 → 2. 获取项目 → 3. 检查当前区域容量
→ 4. 立即部署

备用区域路径(无容量)

1. 检查身份验证 → 2. 获取项目 → 3. 检查当前区域(无容量)
→ 4. 查询所有区域 → 5. 显示替代方案 → 6. 选择区域 + 项目
→ 7. 部署

部署阶段

阶段操作关键命令
1. 验证身份验证检查 Azure CLI 登录和订阅`az account show`, `az login`
2. 获取项目解析 `PROJECT_RESOURCE_ID` ARM ID,验证是否存在`az cognitiveservices account show`
3. 获取模型列出可用模型,用户选择模型和版本`az cognitiveservices account list-models`
4. 检查当前区域使用 GlobalStandard SKU 查询容量`az rest --method GET .../modelCapacities`
5. 多区域查询如果本地无容量,查询所有区域不带位置过滤器的相同容量 API
6. 选择区域 + 项目用户选择区域;查找或创建项目`az cognitiveservices account list`, `az cognitiveservices account create`
7. 部署生成唯一名称,计算容量(50% 可用,最低 50 TPM),创建部署`az cognitiveservices account deployment create`

有关详细的分步说明,请参阅工作流参考。

错误处理

错误症状解决方案
身份验证失败`az account show` 返回错误运行 `az login` 然后 `az account set --subscription `
无配额所有区域显示容量为 0转至配额技能以处理增加请求和故障排除;检查现有部署;尝试其他模型
未找到模型容量列表为空使用 `az cognitiveservices account list-models` 验证模型名称;检查大小写敏感性
名称冲突“部署已存在”在部署名称后附加后缀(由 `generate_deployment_name` 脚本自动处理)
区域不可用区域不支持该模型从可用列表中选择其他区域
权限被拒绝“禁止”或“未经授权”验证认知服务贡献者角色:`az role assignment list --assignee `

高级用法

# 自定义容量
az cognitiveservices account deployment create ... --sku-capacity <value>

# 检查部署状态
az cognitiveservices account deployment show --name <acct> --resource-group <rg> --deployment-name <name> --query "{Status:properties.provisioningState}"

# 删除部署
az cognitiveservices account deployment delete --name <acct> --resource-group <rg> --deployment-name <name>

注意事项

  • SKU: 仅限 GlobalStandard — API 版本: 2024-10-01(GA 稳定版)

相关技能

  • microsoft-foundry - Azure AI Foundry 操作的父级技能
  • quota — 用于查看配额、增加请求和处理配额错误,请转至此技能
  • azure-quick-review - 审查 Azure 资源以符合合规性要求
  • azure-cost-estimation - 估算 Azure 部署的成本
  • azure-validate - 在部署前验证 Azure 基础设施
在 GitHub 上查看
---
name: preset
description: Automates Azure OpenAI model deployment by checking capacity across regions and deploying to the best available option.
license: MIT
---

# Deploy Model to Optimal Region

Automates intelligent Azure OpenAI model deployment by checking capacity across regions and deploying to the best available option.

## What This Skill Does

1. Verifies Azure authentication and project scope
2. Checks capacity in current project's region
3. If no capacity: analyzes all regions and shows available alternatives
4. Filters projects by selected region
5. Supports creating new projects if needed
6. Deploys model with GlobalStandard SKU
7. Monitors deployment progress

## Prerequisites

- Azure CLI installed and configured
- Active Azure subscription with Cognitive Services read/create permissions
- Azure AI Foundry project resource ID (`PROJECT_RESOURCE_ID` env var or provided interactively)
  - Format: `/subscriptions/{sub-id}/resourceGroups/{rg}/providers/Microsoft.CognitiveServices/accounts/{account}/projects/{project}`
  - Found in: Azure AI Foundry portal → Project → Overview → Resource ID

## Quick Workflow

### Fast Path (Current Region Has Capacity)
```
1. Check authentication → 2. Get project → 3. Check current region capacity
→ 4. Deploy immediately
```

### Alternative Region Path (No Capacity)
```
1. Check authentication → 2. Get project → 3. Check current region (no capacity)
→ 4. Query all regions → 5. Show alternatives → 6. Select region + project
→ 7. Deploy
```

---

## Deployment Phases

| Phase | Action | Key Commands |
|-------|--------|-------------|
| 1. Verify Auth | Check Azure CLI login and subscription | `az account show`, `az login` |
| 2. Get Project | Parse `PROJECT_RESOURCE_ID` ARM ID, verify exists | `az cognitiveservices account show` |
| 3. Get Model | List available models, user selects model + version | `az cognitiveservices account list-models` |
| 4. Check Current Region | Query capacity using GlobalStandard SKU | `az rest --method GET .../modelCapacities` |
| 5. Multi-Region Query | If no local capacity, query all regions | Same capacity API without location filter |
| 6. Select Region + Project | User picks region; find or create project | `az cognitiveservices account list`, `az cognitiveservices account create` |
| 7. Deploy | Generate unique name, calculate capacity (50% available, min 50 TPM), create deployment | `az cognitiveservices account deployment create` |

For detailed step-by-step instructions, see [workflow reference](references/workflow.md).

---

## Error Handling

| Error | Symptom | Resolution |
|-------|---------|------------|
| Auth failure | `az account show` returns error | Run `az login` then `az account set --subscription <id>` |
| 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 |
| Model not found | Empty capacity list | Verify model name with `az cognitiveservices account list-models`; check case sensitivity |
| Name conflict | "deployment already exists" | Append suffix to deployment name (handled automatically by `generate_deployment_name` script) |
| Region unavailable | Region doesn't support model | Select a different region from the available list |
| Permission denied | "Forbidden" or "Unauthorized" | Verify Cognitive Services Contributor role: `az role assignment list --assignee <user>` |

---

## Advanced Usage

```bash
# Custom capacity
az cognitiveservices account deployment create ... --sku-capacity <value>

# Check deployment status
az cognitiveservices account deployment show --name <acct> --resource-group <rg> --deployment-name <name> --query "{Status:properties.provisioningState}"

# Delete deployment
az cognitiveservices account deployment delete --name <acct> --resource-group <rg> --deployment-name <name>
```

## Notes

- **SKU:** GlobalStandard only — **API Version:** 2024-10-01 (GA stable)

---

## Related Skills

- **microsoft-foundry** - Parent skill for Azure AI Foundry operations
- **[quota](../../../quota/quota.md)** — For quota viewing, increase requests, and troubleshooting quota errors, defer to this skill
- **azure-quick-review** - Review Azure resources for compliance
- **azure-cost-estimation** - Estimate costs for Azure deployments
- **azure-validate** - Validate Azure infrastructure before deployment

所有文件

0 个文件

安装 preset

将技能文件下载并解压至你的 .claude/skills/ 目录。

下载ZIP

克隆仓库并复制技能文件到您的项目中。

git clone https://github.com/microsoft/skills/tree/main/.github/plugins/azure-skills/skills/microsoft-foundry/models/deploy-model/preset # Copy SKILL.md to your .claude/skills/ directory

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ 目录。Claude 将自动检测并使用该技能。

相关技能

Verification &amp; Quality Assurance
更新时间 2026-06-29
klingai-upgrade-migration
更新时间 2026-07-03
base44-cli
更新时间 2026-06-29
Railway CLI Management
更新时间 2026-07-02
OR