azure-opencode-setup

Configure Azure AI Services (Cognitive Services or OpenAI) as a provider in OpenCode. USE FOR: setup azure opencode, connect azure to opencode, opencode.json azure provider, whitelist azure models, AZURE_COGNITIVE_SERVICES_RESOURCE_NAME, azure /connect, azure 404 401 troubleshoot opencode, az cognitiveservices opencode. DO NOT USE FOR: azure-deploy, microsoft-foundry, azure-resource-lookup, azure-prepare.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "azure-opencode-setup" with this command: npx skills add primeinc/azure-opencode-setup/primeinc-azure-opencode-setup-azure-opencode-setup

Azure AI + OpenCode Setup

When to Use

USE FOR: setup azure opencode, connect azure models to opencode, azure cognitive services opencode, azure openai provider config, opencode.json azure, whitelist azure models, filter azure model list, AZURE_COGNITIVE_SERVICES_RESOURCE_NAME, AZURE_RESOURCE_NAME, azure /connect, azure 404 deployment, azure 401 auth opencode, troubleshoot azure opencode, az cognitiveservices opencode.

DO NOT USE FOR: deploying Azure infrastructure (use azure-deploy), creating AI Foundry projects (use microsoft-foundry), general Azure resource lookup (use azure-resource-lookup), application deployment to Azure (use azure-prepare).

Quick path (one command)

Run the automation script. All params optional — with zero args it scans every subscription and picks the resource with the most deployments:

# PowerShell — dry run (prints JSON, changes nothing)
.\scripts\emit-opencode-azure-cogsvc-config.ps1

# PowerShell — apply (writes opencode.json, sets env var, verifies endpoint)
.\scripts\emit-opencode-azure-cogsvc-config.ps1 -Apply

# Target a specific resource
.\scripts\emit-opencode-azure-cogsvc-config.ps1 -Subscription "<SUB_ID>" -Resource "<RESOURCE>" -Apply
# Bash (requires jq) — same flags
./scripts/emit-opencode-azure-cogsvc-config.sh                    # dry run
./scripts/emit-opencode-azure-cogsvc-config.sh --apply            # apply
./scripts/emit-opencode-azure-cogsvc-config.sh --subscription "<SUB_ID>" --resource "<RESOURCE>" --apply

What the script does (in order):

  1. Scans subscriptions → finds AI resources → picks the one with most deployments
  2. Lists deployments → builds whitelist (deployment names + model names when they differ)
  3. Verifies endpoint with a live API call
  4. With -Apply: merges config into opencode.json, sets env var persistently, writes API key to auth.json

With -Apply, there are zero manual steps. The script writes directly to auth.json (same location /connect uses). Restart OpenCode to pick up changes.

Manual path

StepActionReference
1Discover resourceDiscovery scripts
2Match endpoint → providerTable below
3Verify endpointVerify endpoint
4Set env var (persistent)Platform commands below
5API key stored-Apply writes to auth.json directly. Manual path: /connect in OpenCode.
6Configure opencode.jsonWhitelist + disabled_providers
7Validate quotaQuota validation

Two Azure providers

OpenCode has two Azure providers. They use the same SDK (@ai-sdk/azure) but different endpoints and env vars:

Endpoint patternProvider IDResource name env varCatalog models
*.cognitiveservices.azure.comazure-cognitive-servicesAZURE_COGNITIVE_SERVICES_RESOURCE_NAME94
*.openai.azure.comazureAZURE_RESOURCE_NAME95

Disable the one you don't use via disabled_providers to prevent duplicate model entries.

Source of truth for your endpoint: az cognitiveservices account show -g <RG> -n <RES> --query properties.endpoint -o tsv

Auth flow

Env var = resource name only. The env var tells OpenCode: (a) this provider exists, (b) where to point the base URL.

API key = auth.json only. Stored at ~/.local/share/opencode/auth.json (Windows: %USERPROFILE%\.local\share\opencode\auth.json). Written by -Apply, /connect, or opencode auth login.

Why not AZURE_COGNITIVE_SERVICES_API_KEY? provider.toml declares it, but provider.ts line 901 only extracts the key when env.length === 1. Since this provider has 2 env vars, the key is always undefined via env. auth.json is the only working path.

Format: { "azure-cognitive-services": { "type": "api", "key": "<key>" } }

Set env var (persistent)

The env var holds the resource name only.

Windows (PowerShell):

setx AZURE_COGNITIVE_SERVICES_RESOURCE_NAME "<RESOURCE>"
# Restart terminal for setx to take effect

macOS (zsh):

echo 'export AZURE_COGNITIVE_SERVICES_RESOURCE_NAME="<RESOURCE>"' >> ~/.zshrc
source ~/.zshrc

Linux (bash):

echo 'export AZURE_COGNITIVE_SERVICES_RESOURCE_NAME="<RESOURCE>"' >> ~/.bashrc
source ~/.bashrc

Config template

See config template and whitelist rules for a full opencode.json example, whitelist matching logic, and rules for naming entries.

Multi-resource constraint

One provider config = one Azure resource. AZURE_COGNITIVE_SERVICES_RESOURCE_NAME points to exactly one resource.

If you have multiple resources:

  • Pick the one with most deployments (script auto-picks if --resource omitted)
  • To switch: change the env var and restart OpenCode
  • OpenCode does not support multiple Azure resources in a single config

Self-check: diff deployments vs whitelist

See config template and whitelist rules for a PowerShell self-check script.

Troubleshooting

See troubleshooting — covers 404, 401, wrong endpoint, catalog still showing, quota exceeded, deployment/model name mismatch.

Implementation contracts

See contracts — named invariants for whitelist casing, Windows paths, YAML shell patterns, and ACL implementation.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated