deploy-model
依意圖把 Azure OpenAI 模型部署路由到 preset、自訂或容量探索
中文翻譯
---
name: deploy-model
description: "統一的 Azure OpenAI 模型部署 skill,依意圖智慧路由。處理快速 preset 部署、完整自訂部署(版本/SKU/容量/RAI policy),以及跨 region 和 project 的容量探索。USE FOR: deploy model, deploy gpt, create deployment, model deployment, deploy openai model, set up model, provision model, find capacity, check model availability, where can I deploy, best region for model, capacity analysis. DO NOT USE FOR: listing existing deployments (use foundry_models_deployments_list MCP tool), deleting deployments, agent creation (use agent/create), project creation (use project/create)."
license: MIT
metadata:
author: Microsoft
version: "1.0.0"
---
# Deploy Model
> **範圍:先讀這段。** 這個 skill 是透過 Azure CLI / MCP / portal,以 **out-of-band** 的方式建立模型部署。如果是 azd 管理的 Foundry project(用 `azd ai agent init` 建出來的),請改在 `azure.yaml services.ai-project.deployments[]` 宣告 deployment,`azd ai agent init` 會從範例 manifest 寫入該項目,`azd provision` 再透過 Bicep 建立 deployment。Golden Path 見 [foundry-agent/create/create-hosted.md](../../foundry-agent/create/create-hosted.md)。這個 skill 只用在:(a) 不是 azd project 管理的 Foundry project,(b) azd 生命週期以外的臨時部署。
所有 Azure OpenAI 模型部署流程的統一入口。分析使用者的意圖,路由到適合的部署模式。
## Quick Reference
| Mode | When to Use | Sub-Skill |
|------|-------------|-----------|
| **Preset** | 快速部署,不需要自訂 | [preset/SKILL.md](preset/SKILL.md) |
| **Customize** | 完整控制:版本、SKU、容量、RAI policy | [customize/SKILL.md](customize/SKILL.md) |
| **Capacity Discovery** | 找出哪裡可以部署指定容量 | [capacity/SKILL.md](capacity/SKILL.md) |
## Intent Detection
分析使用者的 prompt,路由到正確的模式:
```
User Prompt
│
├─ Simple deployment (no modifiers)
│ "deploy gpt-4o", "set up a model"
│ └─> PRESET mode
│
├─ Customization keywords present
│ "custom settings", "choose version", "select SKU",
│ "set capacity to X", "configure content filter",
│ "PTU deployment", "with specific quota"
│ └─> CUSTOMIZE mode
│
├─ Capacity/availability query
│ "find where I can deploy", "check capacity",
│ "which region has X capacity", "best region for 10K TPM",
│ "where is this model available"
│ └─> CAPACITY DISCOVERY mode
│
└─ Ambiguous (has capacity target + deploy intent)
"deploy gpt-4o with 10K capacity to best region"
└─> CAPACITY DISCOVERY first → then PRESET or CUSTOMIZE
```
### Routing Rules
| Signal in Prompt | Route To | Reason |
|------------------|----------|--------|
| 只有模型名稱,沒有選項 | **Preset** | 使用者想快速部署 |
| "custom"、"configure"、"choose"、"select" | **Customize** | 使用者想要控制權 |
| "find"、"check"、"where"、"which region"、"available" | **Capacity** | 使用者想做探索 |
| 指定容量數字 + "best region" | **Capacity → Preset** | 先探索,再快速部署 |
| 指定容量數字 + "custom" 類關鍵字 | **Capacity → Customize** | 先探索,再帶選項部署 |
| "PTU"、"provisioned throughput" | **Customize** | PTU 需要選 SKU |
| "optimal region"、"best region"(沒有容量目標) | **Preset** | 最佳化 region 是 preset 的專長 |
### Multi-Mode Chaining
有些 prompt 需要依序用兩種模式:
**Pattern: Capacity → Deploy**
使用者指定了容量需求,而且要部署時:
1. 執行 **Capacity Discovery**,找出配額足夠的 region/project
2. 把結果呈現給使用者
3. 詢問:「要用**快速預設值**部署,還是**自訂設定**?」
4. 依回答路由到 **Preset** 或 **Customize**
> 💡 **Tip:** 不確定使用者要哪種模式時,預設用 **Preset**(快速部署)。想要自訂的使用者通常會明確說出「custom」、「configure」或「with specific settings」之類的關鍵字。
## Project Selection (All Modes)
任何部署之前,都要先決定要部署到哪個 project。這適用於**所有**模式(preset、customize,以及容量探索之後)。
### Resolution Order
1. **檢查 `PROJECT_RESOURCE_ID` 環境變數**:有設就當預設值
2. **檢查使用者的 prompt**:使用者有指定 project 或 region 就用那個
3. **都沒有**:查詢使用者的 project,並建議目前的那一個
### Confirmation Step (Required)
**部署之前一定要先確認目標。** 把要用的內容給使用者看,讓他有機會更改:
```
Deploying to:
Project: <project-name>
Region: <region>
Resource: <resource-group>
Is this correct? Or choose a different project:
1. ✅ Yes, deploy here (default)
2. 📋 Show me other projects in this region
3. 🌍 Choose a different region
```
如果使用者選 2,顯示該 region 前 5 個 project:
```
Projects in <region>:
1. project-alpha (rg-alpha)
2. project-beta (rg-beta)
3. project-gamma (rg-gamma)
...
```
> ⚠️ **沒讓使用者看到要用哪個 project 之前,絕對不准部署。** 這樣才不會誤部署到錯的資源。
## Pre-Deployment Validation (All Modes)
在呈現任何部署選項(SKU、容量)之前,一定要先驗證這兩件事:
1. **模型支援該 SKU**:查詢模型目錄,確認所選的模型+版本支援目標 SKU:
```bash
az cognitiveservices model list --location <region> --subscription <sub-id> -o json
```
過濾出該模型,取 `.model.skus[].name` 得到支援的 SKU。
2. **Subscription 有可用配額**:檢查使用者的 subscription 對這組 SKU+模型還有沒有未分配的配額:
```bash
az cognitiveservices usage list --location <region> --subscription <sub-id> -o json
```
用 usage 名稱格式 `OpenAI.<SKU>.<model-name>` 比對(例如 `OpenAI.GlobalStandard.gpt-4o`)。計算 `available = limit - currentValue`。
> ⚠️ **警告:** 只呈現兩項檢查都通過的選項。不要顯示寫死的 SKU 清單,一定要動態查詢。可用配額是 0 的 SKU 要用 ❌ 標成純資訊項目,不能當作可選的選項。
> 💡 **配額管理:** 申請增加配額、監控用量和排除配額錯誤,都交給 [quota skill](../../quota/quota.md),不要在這裡重複寫一份指引。
## Prerequisites
所有部署模式都需要:
- 已安裝並登入 Azure CLI(`az login`)
- 有部署權限的啟用中 Azure subscription
- Microsoft Foundry project 的 resource ID(或由 agent 透過 `PROJECT_RESOURCE_ID` 環境變數協助探索)
## Sub-Skills
- **[preset/SKILL.md](preset/SKILL.md)** — 用合理的預設值快速部署到最佳 region
- **[customize/SKILL.md](customize/SKILL.md)** — 互動式引導流程,可完整控制設定
- **[capacity/SKILL.md](capacity/SKILL.md)** — 探索跨 region 和 project 的可用容量英文原文
---
name: deploy-model
description: "Unified Azure OpenAI model deployment skill with intelligent intent-based routing. Handles quick preset deployments, fully customized deployments (version/SKU/capacity/RAI policy), and capacity discovery across regions and projects. USE FOR: deploy model, deploy gpt, create deployment, model deployment, deploy openai model, set up model, provision model, find capacity, check model availability, where can I deploy, best region for model, capacity analysis. DO NOT USE FOR: listing existing deployments (use foundry_models_deployments_list MCP tool), deleting deployments, agent creation (use agent/create), project creation (use project/create)."
license: MIT
metadata:
author: Microsoft
version: "1.0.0"
---
# Deploy Model
> **Scope — read this first.** This skill creates model deployments **out-of-band** via Azure CLI / MCP / portal. For azd-managed Foundry projects (those scaffolded from `azd ai agent init`), declare deployments in `azure.yaml services.ai-project.deployments[]` instead — `azd ai agent init` writes the entry from the sample manifest and `azd provision` creates the deployment through Bicep. See [foundry-agent/create/create-hosted.md](../../foundry-agent/create/create-hosted.md) for the Golden Path. Use this skill only for: (a) Foundry projects not managed by an azd project, (b) ad-hoc deployments outside the azd lifecycle.
Unified entry point for all Azure OpenAI model deployment workflows. Analyzes user intent and routes to the appropriate deployment mode.
## Quick Reference
| Mode | When to Use | Sub-Skill |
|------|-------------|-----------|
| **Preset** | Quick deployment, no customization needed | [preset/SKILL.md](preset/SKILL.md) |
| **Customize** | Full control: version, SKU, capacity, RAI policy | [customize/SKILL.md](customize/SKILL.md) |
| **Capacity Discovery** | Find where you can deploy with specific capacity | [capacity/SKILL.md](capacity/SKILL.md) |
## Intent Detection
Analyze the user's prompt and route to the correct mode:
```
User Prompt
│
├─ Simple deployment (no modifiers)
│ "deploy gpt-4o", "set up a model"
│ └─> PRESET mode
│
├─ Customization keywords present
│ "custom settings", "choose version", "select SKU",
│ "set capacity to X", "configure content filter",
│ "PTU deployment", "with specific quota"
│ └─> CUSTOMIZE mode
│
├─ Capacity/availability query
│ "find where I can deploy", "check capacity",
│ "which region has X capacity", "best region for 10K TPM",
│ "where is this model available"
│ └─> CAPACITY DISCOVERY mode
│
└─ Ambiguous (has capacity target + deploy intent)
"deploy gpt-4o with 10K capacity to best region"
└─> CAPACITY DISCOVERY first → then PRESET or CUSTOMIZE
```
### Routing Rules
| Signal in Prompt | Route To | Reason |
|------------------|----------|--------|
| Just model name, no options | **Preset** | User wants quick deployment |
| "custom", "configure", "choose", "select" | **Customize** | User wants control |
| "find", "check", "where", "which region", "available" | **Capacity** | User wants discovery |
| Specific capacity number + "best region" | **Capacity → Preset** | Discover then deploy quickly |
| Specific capacity number + "custom" keywords | **Capacity → Customize** | Discover then deploy with options |
| "PTU", "provisioned throughput" | **Customize** | PTU requires SKU selection |
| "optimal region", "best region" (no capacity target) | **Preset** | Region optimization is preset's specialty |
### Multi-Mode Chaining
Some prompts require two modes in sequence:
**Pattern: Capacity → Deploy**
When a user specifies a capacity requirement AND wants deployment:
1. Run **Capacity Discovery** to find regions/projects with sufficient quota
2. Present findings to user
3. Ask: "Would you like to deploy with **quick defaults** or **customize settings**?"
4. Route to **Preset** or **Customize** based on answer
> 💡 **Tip:** If unsure which mode the user wants, default to **Preset** (quick deployment). Users who want customization will typically use explicit keywords like "custom", "configure", or "with specific settings".
## Project Selection (All Modes)
Before any deployment, resolve which project to deploy to. This applies to **all** modes (preset, customize, and after capacity discovery).
### Resolution Order
1. **Check `PROJECT_RESOURCE_ID` env var** — if set, use it as the default
2. **Check user prompt** — if user named a specific project or region, use that
3. **If neither** — query the user's projects and suggest the current one
### Confirmation Step (Required)
**Always confirm the target before deploying.** Show the user what will be used and give them a chance to change it:
```
Deploying to:
Project: <project-name>
Region: <region>
Resource: <resource-group>
Is this correct? Or choose a different project:
1. ✅ Yes, deploy here (default)
2. 📋 Show me other projects in this region
3. 🌍 Choose a different region
```
If user picks option 2, show top 5 projects in that region:
```
Projects in <region>:
1. project-alpha (rg-alpha)
2. project-beta (rg-beta)
3. project-gamma (rg-gamma)
...
```
> ⚠️ **Never deploy without showing the user which project will be used.** This prevents accidental deployments to the wrong resource.
## Pre-Deployment Validation (All Modes)
Before presenting any deployment options (SKU, capacity), always validate both of these:
1. **Model supports the SKU** — query the model catalog to confirm the selected model+version supports the target SKU:
```bash
az cognitiveservices model list --location <region> --subscription <sub-id> -o json
```
Filter for the model, extract `.model.skus[].name` to get supported SKUs.
2. **Subscription has available quota** — check that the user's subscription has unallocated quota for the SKU+model combination:
```bash
az cognitiveservices usage list --location <region> --subscription <sub-id> -o json
```
Match by usage name pattern `OpenAI.<SKU>.<model-name>` (e.g., `OpenAI.GlobalStandard.gpt-4o`). Compute `available = limit - currentValue`.
> ⚠️ **Warning:** Only present options that pass both checks. Do NOT show hardcoded SKU lists — always query dynamically. SKUs with 0 available quota should be shown as ❌ informational items, not selectable options.
> 💡 **Quota management:** For quota increase requests, usage monitoring, and troubleshooting quota errors, defer to the [quota skill](../../quota/quota.md) instead of duplicating that guidance inline.
## Prerequisites
All deployment modes require:
- Azure CLI installed and authenticated (`az login`)
- Active Azure subscription with deployment permissions
- Microsoft Foundry project resource ID (or agent will help discover it via `PROJECT_RESOURCE_ID` env var)
## Sub-Skills
- **[preset/SKILL.md](preset/SKILL.md)** — Quick deployment to optimal region with sensible defaults
- **[customize/SKILL.md](customize/SKILL.md)** — Interactive guided flow with full configuration control
- **[capacity/SKILL.md](capacity/SKILL.md)** — Discover available capacity across regions and projects