Guidance for AI coding agents (Claude Code, OpenAI Codex, Cursor, Gemini CLI, Amp, Goose, and others) working in this repository. GitHub Copilot reads .github/copilot-instructions.md natively; this file is the universal pointer for everyone else.
This repo deploys one or more Claude models (haiku, sonnet, opus) into a Microsoft Foundry account with a single command (azd up), then wires the Anthropic SDK and the Claude Code CLI to it over Microsoft Entra ID (no API keys). Bicep and Terraform variants ship side by side.
Short link: https://aka.ms/claude/start
For any deploy, verify, modify, debug, or teardown request, follow the full playbook in skills/claude-on-foundry/SKILL.md. It contains the decision tree, env-var contract, region matrix, error catalog, and destructive-action policy.
The always-on rules below are the same ones in .github/copilot-instructions.md, restated here so non-Copilot agents have them inline.
- Two IaC variants ship side by side. The user picks ONE. Never edit or run both in the same
azd env.- Bicep:
infra-bicep/— runcd infra-bicep && azd up - Terraform:
infra-terraform/— runcd infra-terraform && azd up
- Bicep:
- Single entrypoint:
azd upfrom inside the chosen variant folder. Two hooks fire automatically:preprovisionrunsscripts/preflight-claude.ps1(catalog + quota gate). Never bypass it.postprovisionrunsscripts/configure-claude-code.ps1to wire Claude Code + the SDK to the new deployment.
- Configure via
azd env set <KEY> <VALUE>from inside the chosen variant folder. There is no.envfile. See the env-var contract in.github/copilot-instructions.md. CLAUDE_INDUSTRYmust be lowercase:technology,finance,healthcare,education,retail,manufacturing,government,media,other. Uppercase fails withAnthropicOrganizationCreationException.- Honor the user's region.
eastus2andswedencentralhost all three families;westus2is sonnet + opus only. Don't silently changeAZURE_LOCATION. - Passwordless only. Microsoft Entra ID via
DefaultAzureCredential/az login. Never writeCLAUDE_API_KEY, subscription IDs, tenant IDs, or tokens into any tracked file. Real values live in env vars, the gitignored.env.local, or the gitignored.azure-cli/token cache. - Confirm before destructive actions. Always get explicit user OK before:
azd down,az cognitiveservices account purge,az role assignment delete, deleting.azure-cli/, editing~/.claude/settings.json. Never pass--no-promptto skip hooks. - Diagnose, don't guess. When a deployment fails, identify the exact error fingerprint (
715-123420,InsufficientQuota,AnthropicOrganizationCreationException,403 Forbidden,401 PermissionDenied) and follow the matching row in the skill's DIAGNOSE table. - Run the existing scripts. Don't invent ad-hoc
azcommands whenGet-ClaudeCatalog.ps1,scripts/preflight-claude.ps1,scripts/configure-claude-code.ps1,scripts/verify-claude-code.ps1, orsrc/check_claude_quota.pyalready cover the case.
After a deploy, run scripts/verify-claude-code.ps1 (or scripts/verify-claude-code.sh). It checks the activator, env vars, .vscode/settings.json, az login + tenant, claude on PATH, then does a claude -p round trip per deployed family. Exits non-zero on hard failures.
- Full README: README.md
- Skill body:
skills/claude-on-foundry/SKILL.md - Agent Skills manifest:
.github/agents/claude-on-foundry.agent.md - Copilot always-on rules:
.github/copilot-instructions.md