Skip to content

exp(deploy): [preflight] microsoft foundry baseline azure subscription fit#92

Draft
ferantivero wants to merge 2 commits intoAzure-Samples:mainfrom
ferantivero:topic/preflight-az-subscription-deployment
Draft

exp(deploy): [preflight] microsoft foundry baseline azure subscription fit#92
ferantivero wants to merge 2 commits intoAzure-Samples:mainfrom
ferantivero:topic/preflight-az-subscription-deployment

Conversation

@ferantivero
Copy link
Copy Markdown
Contributor

@ferantivero ferantivero commented Mar 25, 2026

WHY

Deploying this reference implementation requires multiple Azure resources to coexist in a single region. Each has its own availability, quota limits, and subscription restrictions that vary per subscription. Discovering region incompatibilities mid-deployment wastes time and leaves partial resources that require manual cleanup.

WHAT

Two-phase best-first branch-and-bound region search that scores every constraint as 0 (eliminated), 1 (degraded), or 2 (exact match). Degraded scores map to Bicep parameter changes needed (the "delta").

Phase Data source Checks
1 Rank Global APIs VM SKU, storage, App Service, zones, AI Search, AI Foundry
2 Probe Per-region APIs (best-first) Model quota, vCPU, SKU restrictions, App Service quota

Highlights:

  • Fallback chains for VM gen, storage tier, App Service SKU, and model tier/version, degraded but viable
  • Joint VM+vCPU resolution, walks alt-gen VMs confirmed available in the region when primary family has no quota
  • Early termination, Phase 2 stops when a region meets the MAX_DELTA tolerance
  • Resource name availability checks for storage, Key Vault, Cosmos DB, and AI Search
  • Unified region normalization across all Azure APIs, which return inconsistent formats
File Role
preflight-score.py Scoring engine (Python)
preflight.sh Orchestrator (Bash), data collection, B&B search, name checks

TEST

Typical run: ~80s evaluating 29 candidate regions, with early termination after first viable match. Each additional region probe adds ~15-20s.
P1
image
P2
image

ferantivero and others added 2 commits March 25, 2026 12:45
Python scoring engine that ranks Azure regions by deployment viability
using a 0 (eliminated) / 1 (degraded) / 2 (perfect) scoring model.

Phase 1 scoring (global, offline data):
- VM SKU availability with same-family gen fallback
- Storage SKU availability with tier fallback chains
- App Service Plan availability with SKU alternatives and zone redundancy
- Availability zones (≥3 AZ preferred)
- Hard filters for AI Search and AI Foundry region coverage

Phase 2 scoring (per-region API calls):
- Model quota with tier/version alternatives
- vCPU quota with joint VM+vCPU resolution — walks alt-gen VMs when
  primary family has no quota, verifying both SKU availability and vCPU
- VM SKU subscription restrictions with zone-aware fallback
- App Service Plan instance quota

CLI subcommands: candidates, filter, delta, report. Exits non-zero
when no viable region is found.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Shell script that collects Azure data in parallel and drives the
scoring engine through a best-first branch-and-bound region search.

Phase 1 — parallel global API calls:
- VM SKUs via Azure retail pricing API (curl + jq)
- Storage, App Service, zones, AI Search, CogSvc availability
- Resource name availability (storage, Key Vault, Cosmos DB, AI Search)

Phase 2 — per-region probes (best-first with early termination):
- Model quota gate (skip region immediately if no quota)
- vCPU headroom, SKU restrictions, App Service quota (parallel)
- Stops when a region meets MAX_DELTA threshold

Required env vars: VM_SKU, STORAGE, MODEL, APP_SKU, BASE_NAME,
STA_NAME, STW_NAME, KV_NAME, CDB_NAME, AIS_NAME.
Optional: MODEL_EXCLUDE, MAX_DELTA (default 0), APP_CAPACITY (default 3).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant