Skip to content

Add CLAUDE_SKIP_VSCODE_SETTINGS opt-out for the postprovision hook #25

@achandmsft

Description

@achandmsft

Reported by @pamelafox after the previous fixes (#22, #24).

The postprovision hook (scripts/configure-claude-code.{ps1,sh}) writes / merges .vscode/settings.json with three blocks of workspace settings:

{
  "claudeCode.environmentVariables": [
    { "name": "CLAUDE_CODE_USE_FOUNDRY",          "value": "1" },
    { "name": "ANTHROPIC_FOUNDRY_RESOURCE",       "value": "<foundry-account>" },
    { "name": "ANTHROPIC_DEFAULT_SONNET_MODEL",   "value": "<deployment>" }
    // ... one per deployed family
  ],
  "claudeCode.disableLoginPrompt": true,
  "terminal.integrated.env.windows": { "AZURE_CONFIG_DIR": "${workspaceFolder}\\.azure-cli" },
  "terminal.integrated.env.linux":   { "AZURE_CONFIG_DIR": "${workspaceFolder}/.azure-cli" },
  "terminal.integrated.env.osx":     { "AZURE_CONFIG_DIR": "${workspaceFolder}/.azure-cli" }
}

Why we write it — the claudeCode.* keys are read by the Anthropic Claude Code VS Code extension so it routes through Foundry over Entra ID instead of prompting for an Anthropic API key. The terminal.integrated.env.* keys scope az login to the workspace-local .azure-cli/ folder so terminals VS Code spawns inherit the scoping without sourcing the activator first.

Pamela's problem

Not everyone uses the Claude Code extension. People deploying just to call Claude from the Anthropic SDK, or from Copilot, or from another tool, don't need the claudeCode.* keys at all — and getting workspace settings written under them by azd up is surprising. There's currently no opt-out env var.

(For context: the "Haiku from Foundry Toolkit" Copilot Chat error in her workspace is a separate issue — the AI Toolkit extension auto-discovers the new Foundry account and registers its catalog models with Copilot regardless of what's deployed. Copilot ignores the claudeCode.* namespace. But the .vscode/settings.json write made it feel like we'd touched something we hadn't.)

Proposed resolution

Add CLAUDE_SKIP_VSCODE_SETTINGS to the env-var contract:

Env var Default Effect
CLAUDE_SKIP_VSCODE_SETTINGS unset Hook writes / merges .vscode/settings.json as today
CLAUDE_SKIP_VSCODE_SETTINGS=1 Hook skips the entire .vscode/settings.json step. The activator at the repo root still gets written so claude from a sourced shell still works.

Set once at deploy time: azd env set CLAUDE_SKIP_VSCODE_SETTINGS 1.

Both scripts already accept a -SkipVsCodeSettings / --skip-vscode-settings flag for the standalone re-run case; this adds the env-var path so the hook honors it too. Also rename the existing bash SKIP_VSCODE_SETTINGS env var to CLAUDE_SKIP_VSCODE_SETTINGS to match the CLAUDE_* namespace used by the rest of the contract (keep the old name as a deprecated alias for one release).

Files to change

  • scripts/configure-claude-code.ps1 — honor $env:CLAUDE_SKIP_VSCODE_SETTINGS
  • scripts/configure-claude-code.sh — honor $CLAUDE_SKIP_VSCODE_SETTINGS (alias the old SKIP_VSCODE_SETTINGS)
  • README.md — document the opt-out in the Claude Code post-deploy section
  • .github/copilot-instructions.md — add a row to the env-var contract table
  • skills/claude-on-foundry/SKILL.md — add an entry to the MODIFY table

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions