fix(iac): wire pipeline MI for AAD storage data-plane on indexer_webjobs#84
Merged
Merged
Conversation
CD-dev was failing on 'tofu apply — infra-only' with:
KeyBasedAuthenticationNotPermitted: Key based authentication is
not permitted on this storage account.
Root cause chain:
1. Indexer storage account has shared_access_key_enabled = false
2. azurerm provider's post-create blob data-plane wait uses key
auth by default → 403s
3. provider config adds storage_use_azuread = true to switch to AAD
4. But the pipeline MI has no Storage Blob Data role on the new
account, so AAD also 403s
5. To grant the role, Storage Blob Data Owner must be in the
bootstrap pipeline-RBAC-Admin condition allowlist
This change ships all four pieces:
A. iac/platform-bootstrap/main.tf — adds Storage Blob Data Owner
role GUID (b7e6dc6d-f1e8-4753-8033-0f276bb0955b) to the
pipeline_role_admin condition allowlist. After merge an operator
must run 'tofu apply' against the bootstrap module before CD-dev
can succeed (bootstrap state is operator-held per the module's
README, not CI-applied).
B. iac/environments/dev/providers.tf — adds storage_use_azuread =
true to the azurerm provider so data-plane wait + future ops use
AAD across the dev composition.
C. iac/environments/dev/main.tf — adds inline pipeline self-grant
for Storage Blob Data Owner at RG scope, with a 60s time_sleep
for AAD propagation matching the existing
wait_for_kv_rbac_propagation pattern. Storage account depends_on
the sleep so creation only proceeds after the role has propagated.
D. scripts/lint-iac-inline-iam.sh — allowlists the new inline IAM
resource (pipeline self-grant scope is the env RG, not foldable
into the workload-identity module).
The workload UAMI's grant for runtime AAD usage continues to flow
through workload-identity module's assigned_azure_rbac map.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
OpenTofu plan —
|
| Rule | Status | Detail |
|---|---|---|
| BT-IAC-001 | PASS | BT-IAC-001: PASS |
| BT-IAC-002 | SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) | BT-IAC-002: SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) |
| BT-IAC-003 | PASS | BT-IAC-003: PASS |
| BT-IAC-004 | PASS | BT-IAC-004: PASS |
| BT-IAC-005 | PASS | BT-IAC-005: PASS |
| BT-IAC-006 | PASS | BT-IAC-006: PASS |
| BT-IAC-007 | FAIL | BT-IAC-007 FAIL: plan would delete+create stateful resource azurerm_storage_account.indexer_webjobs (state would be lost). Manual reviewer approval required. |
Totals: 6 pass · 1 fail · 0 setup error(s)
⚠️ REQUIRES MANUAL APPROVAL — BT-IAC-007 detected a stateful destroy. CI must pause for reviewer sign-off before apply.
OpenTofu plan —
|
| Rule | Status | Detail |
|---|---|---|
| BT-IAC-001 | PASS | BT-IAC-001: PASS |
| BT-IAC-002 | SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) | BT-IAC-002: SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) |
| BT-IAC-003 | PASS | BT-IAC-003: PASS |
| BT-IAC-004 | PASS | BT-IAC-004: PASS |
| BT-IAC-005 | PASS | BT-IAC-005: PASS |
| BT-IAC-006 | PASS | BT-IAC-006: PASS |
| BT-IAC-007 | FAIL | BT-IAC-007 FAIL: plan would delete+create stateful resource azurerm_storage_account.indexer_webjobs (state would be lost). Manual reviewer approval required. |
Totals: 6 pass · 1 fail · 0 setup error(s)
⚠️ REQUIRES MANUAL APPROVAL — BT-IAC-007 detected a stateful destroy. CI must pause for reviewer sign-off before apply.
OpenTofu plan —
|
| Rule | Status | Detail |
|---|---|---|
| BT-IAC-001 | PASS | BT-IAC-001: PASS |
| BT-IAC-002 | SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) | BT-IAC-002: SKIP (env 'dev' is non-prod; rule is prod-only per Q2c) |
| BT-IAC-003 | PASS | BT-IAC-003: PASS |
| BT-IAC-004 | PASS | BT-IAC-004: PASS |
| BT-IAC-005 | PASS | BT-IAC-005: PASS |
| BT-IAC-006 | PASS | BT-IAC-006: PASS |
| BT-IAC-007 | PASS | BT-IAC-007: PASS |
Totals: 7 pass · 0 fail · 0 setup error(s)
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
Follow-up to PR #83 which merged before CD-dev could prove it out. CD-dev on
mainis now failing attofu apply — infra-onlywith:Root cause chain:
shared_access_key_enabled = falsestorage_use_azuread = trueto switch to AADiac/platform-bootstrap/main.tfpipeline_role_admin conditionWhat ships
A.
iac/environments/dev/providers.tf—storage_use_azuread = trueon the azurerm provider so data-plane ops use AAD across the dev composition.B.
iac/environments/dev/main.tf:Storage Blob Data Ownerat RG scope (mirrors thepipeline_kv_secrets_officershape).time_sleep.wait_for_storage_rbac_propagationmatching the existing KV propagation sleep.depends_onthe sleep so creation only proceeds after the role has propagated.C.
iac/platform-bootstrap/main.tf:b7e6dc6d-f1e8-4753-8033-0f276bb0955b) to thepipeline_role_admincondition allowlist.D.
scripts/lint-iac-inline-iam.sh— allowlistspipeline_storage_blob_data_owner(per-env pipeline grant, can't be folded into the workload-identity module).Operator action required after merge
The platform-bootstrap state is operator-held (per
iac/platform-bootstrap/README.md), not CI-applied. After this PR merges, the bootstrap allowlist update must be applied manually before CD-dev will succeed:After that, re-run CD-dev (or just let the next merge trigger it) — it should pass
tofu apply — infra-onlycleanly.Test plan
tofu validateclean inenvironments/devscripts/lint-iac-inline-iam.shpasses locallyazure.functions.webjobs.storage: Healthyin indexer logs (replaces the Unhealthy noise)🤖 Generated with Claude Code