Skip to content

Preflight blocks zd up on a clean machine (no env vars set / no z login) #21

@achandmsft

Description

@achandmsft

Reported by @pamelafox while trying the starter for the first time. Two related friction points block azd up on a clean machine:

Bug 1 — preflight blocks the interactive Bicep prompt

infra-bicep/infra/main.parameters.json declares claudeOrganizationName without a default:

"claudeOrganizationName": { "value": "${CLAUDE_ORGANIZATION_NAME}" }

When CLAUDE_ORGANIZATION_NAME is unset, azd / Bicep would normally prompt interactively for the claudeOrganizationName parameter. But the preprovision hook runs scripts/preflight-claude.ps1 first, which hard-fails on:

ERROR: CLAUDE_ORGANIZATION_NAME is required. Run: azd env set CLAUDE_ORGANIZATION_NAME 'Your Org'

so the interactive prompt never gets a chance to appear.

Bug 2 — preflight hard-fails when Azure CLI isn't installed or signed in

The README's Prerequisites section lists Azure CLI as a tool to install, but does not mention az login. If az isn't on PATH (or the user hasn't run az login), the preflight exits with:

ERROR: Azure CLI (az) not found on PATH. ...
ERROR: No active Azure subscription. Run: az login ...

That blocks the deploy entirely, even though azd auth login is the documented auth flow for the deploy itself. The marketplace catalog and per-region quota checks need az, but the deploy can still proceed without them — the resource provider will surface any catalog / quota errors at deploy time (less ergonomic, but not broken).

Suggested fix (from Pamela)

you can make the preflight exit gracefully in that case and just say "couldn't perform validation due to az not being installed/loggedin"

Proposed resolution

Convert the four "soft" hard-fails into warnings that let the deploy continue, while keeping the two "hard" gates that are the entire reason the preflight exists:

Check Today After fix
CLAUDE_ORGANIZATION_NAME empty hard fail (exit 1) warn, continue (azd will prompt for the Bicep parameter)
AZURE_LOCATION empty hard fail (exit 1) warn, skip catalog + quota checks, exit 0 (azd will prompt)
az not on PATH hard fail (exit 2) warn, skip catalog + quota checks, exit 0
az not logged in hard fail (exit 2) warn, skip catalog + quota checks, exit 0
Marketplace offer not found hard fail (exit 4) unchanged — typos and unreleased SKUs must fail fast
Insufficient quota hard fail (exit 6) unchanged — the whole point of the preflight (Terraform azapi swallows quota errors into opaque 715-123420)

Plus a small README update so az login is called out explicitly as a recommended (not strictly required) prerequisite for proactive validation.

Files to change

  • scripts/preflight-claude.ps1
  • scripts/preflight-claude.sh
  • README.md (Prerequisites)
  • skills/claude-on-foundry/SKILL.md (PLAN section — preflight is now best-effort, not a hard gate)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    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