feat(infra) Bicep shared-resources scaffold + ADR 0010 subscription guard#27
Merged
Merged
Conversation
…uard
Track A.3 of the parallel execution plan: Bicep IaC scaffold for the
pinwiz.ai shared tier, with ADR 0010 codifying the personal-Azure-only
rule and a hard `az account show` subscription/tenant guard in the
deploy script that aborts before any Azure call if the active az
context isn't the personal Earlybird tenant + subscription.
Files:
infra/
- main-shared.bicep Subscription-scoped entry. Creates the shared
resource group (rg-pinwiz-shared-{env}) with
project tags and invokes the shared module.
- modules/shared.bicep RG-scoped resources:
Cosmos DB Serverless (NoSQL API)
Key Vault (RBAC, purge protection)
Container Registry Basic
Azure AI Search Basic (semantic ranker free tier)
Azure OpenAI account (S0; model deployments
deferred to follow-up - quota provisioning)
Storage Standard LRS (Entra-only, no shared
key) with pinwiz-raw / -processed / -photos
blob containers per infra_analysis.md
Log Analytics (1 GB/day cap, 30-day retention)
Application Insights (workspace-based)
Diagnostic settings on every resource routing
to LAW
Optional developer RBAC (KV Secrets Officer,
AcrPush, Search Index Data Contributor,
Cognitive Services OpenAI User, Storage
Blob Data Contributor) gated on
developerObjectId being non-empty
- main-shared.dev.bicepparam Dev environment parameters; subscription /
tenant IDs are committed (identifiers, not
credentials).
- scripts/Deploy-SharedResources.ps1 Deploy orchestrator. Hard guard
against EXPECTED_TENANT_ID +
EXPECTED_SUBSCRIPTION_ID before any Azure
call. Auto-detects local override
parameter file. Supports -WhatIf and
-SkipGuard (with unmissable warning).
- README.md Deploy docs, prereqs, what-if usage, cost
expectations, what's intentionally not in
this scaffold (per-env ACA, AOAI model
deployments, OIDC for GH Actions, etc.)
docs/adr/0010-personal-azure-subscription-only.md Codifies the rule
alongside the existing ADR 0005 (own
resource groups). 0005 is about resource
isolation within the chosen subscription;
0010 is about which subscription is even
allowed.
docs/adr/README.md Index updated to include 0010.
.github/workflows/bicep.yml CI workflow: bicep build + lint on
main-shared.bicep, modules/shared.bicep,
main-shared.dev.bicepparam on every PR
touching infra/**. Does not authenticate
to Azure (OIDC federated credentials are
a separate follow-up).
.gitignore Add *.local.bicepparam so contributors can
override committed parameters locally
without committing the override.
CHANGELOG.md [Unreleased] entry for Track A.3 + the
ADR batch entry now that PR 26 has merged.
Local validation:
az bicep build --file infra/main-shared.bicep OK
az bicep build --file infra/modules/shared.bicep OK
az bicep build-params --file infra/main-shared.dev.bicepparam OK
az bicep lint clean
Per the locked feedback memory feedback_personal_identity_only.md and
ADR 0010, the deploy script will refuse to run if the active az
context is the day-job tenant. This is the enforcement of the personal
/work separation that this repo's portfolio framing depends on.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Track A.3 of the parallel execution plan: Bicep IaC scaffold for the pinwiz.ai shared tier, with ADR 0010 codifying the personal-Azure-only rule and a hard
az account showsubscription/tenant guard in the deploy script.This unblocks the Bicep dependency for Gate 1 (Cosmos schema), Track D (Event-driven RAG → Cosmos Change Feed), and Track E (Frontend Cosmos repos) — all of which need the Cosmos account to exist before they can deploy / integration-test against it.
What ships
infra/main-shared.bicep— subscription-scoped entry. Createsrg-pinwiz-shared-{env}with project tags, invokes the shared module.modules/shared.bicep— RG-scoped resources:pinwiz-raw/pinwiz-processed/pinwiz-photosblob containers perinfra_analysis.mddeveloperObjectIdbeing non-empty in the parameters filemain-shared.dev.bicepparam— dev parameters; subscription/tenant IDs committed (identifiers, not credentials)scripts/Deploy-SharedResources.ps1— deploy orchestrator with the hard guard againstEXPECTED_TENANT_ID+EXPECTED_SUBSCRIPTION_IDbefore any Azure call. Aborts cleanly with the fix command if the active az context is wrong. Supports-WhatIfand-SkipGuard(with unmissable warning).README.md— deploy docs, prereqs, what-if usage, cost expectations (~$90–120/mo for shared tier before model deployments), and explicit "what's NOT in this scaffold" listdocs/adr/0010-personal-azure-subscription-only.md— codifies the rule alongside the existing ADR 0005. (0005 = own resource groups within the chosen subscription; 0010 = which subscription is even allowed.)README.md— index updated to include 0010..github/workflows/bicep.yml—bicep build+bicep lintonmain-shared.bicep,modules/shared.bicep, andmain-shared.dev.bicepparamon every PR touchinginfra/**. Uploads built ARM templates as artifacts. Does not authenticate to Azure (OIDC federated credentials are a separate follow-up).Other
.gitignore— adds*.local.bicepparamso contributors can override committed parameters locally without committing the override.CHANGELOG.md—[Unreleased]entry for Track A.3 + the ADR batch entry (now that PR docs(adr) add ADR batch 0001-0009 codifying decisions already made #26 has merged).Subscription guard demonstrated
Deploy-SharedResources.ps1enforces ADR 0010 with a hard guard. Frominfra/scripts/Deploy-SharedResources.ps1#L60-L100:This is the technical enforcement of the locked feedback memory (
feedback_personal_identity_only.md).Test Plan
az bicep build --file infra/main-shared.bicep— succeeds; produces valid ARM JSONaz bicep build --file infra/modules/shared.bicep— OKaz bicep build-params --file infra/main-shared.dev.bicepparam— OKaz bicep linton both.bicepfiles — clean (no warnings or errors)Deploy-SharedResources.ps1syntax validated locallybicep.yml) will re-validate on this PR-WhatIfdeployment against the personal Earlybird subscription — pending, run before merge:docs/parallel_execution_plan.md§6 quality discipline).Out of Scope
main-env.bicep) — ships when Track B / D / E need a deployment targetbicep.ymlworkflow runwhat-ifautomatically; separate PRdocs/infra_analysis.md§7Cost expectations once deployed
Per-environment ACA layer adds $3–35/mo when it ships. $400/mo hard cap still in force at the subscription level.
What's next after this merges
Per the parallel execution plan recommended sequence:
Gate 1 and Gate 2 can run in true parallel after this scaffold lands, since they target different parts of the codebase.