Skip to content

Serialize Claude model deployments after Foundry role assignments to absorb RBAC propagation lag - #39

Merged
Arun Sekhar (achandmsft) merged 1 commit into
mainfrom
rbac-before-deployments
Jun 11, 2026
Merged

Serialize Claude model deployments after Foundry role assignments to absorb RBAC propagation lag#39
Arun Sekhar (achandmsft) merged 1 commit into
mainfrom
rbac-before-deployments

Conversation

@achandmsft

Copy link
Copy Markdown
Collaborator

Closes #38.

Summary

When ASSIGN_RBAC=true, both IaC variants now order each Claude model deployment after the Foundry User + Foundry Project Manager role assignments on the Foundry account. The role-assignment PUTs return fast (~5 s) but Foundry data-plane RBAC takes a few minutes to propagate; the slow model-deployment LRO (30 s–20 min) absorbs that propagation wait, so the first claude -p / Python SDK call after azd up succeeds without retries.

Changes

  • infra-bicep/infra/foundry.bicep — moved foundryUserAssignment / foundryProjectManagerAssignment declarations above the deployments and added both to each deployment's dependsOn. Comment explains the intent.
  • infra-terraform/infra/main.tf — added the two azurerm_role_assignment resources to each azapi_resource.claude_* depends_on. Comment explains the intent.
  • README.md
    • "What gets provisioned" RBAC bullet: noted the ordering and why it matters.
    • Troubleshooting row for intermittent 401 PermissionDenied: updated to reflect the new behavior; the manual-grant path still needs the usual wait.

Why this works in all four cases

RBAC on RBAC off
Model family deployed Deployment waits for both role assignments, then runs. dependsOn edges to if(false) / count=0 resources are dropped — no wait.
Model family not deployed Deployment is if(false) / count=0; no work at all. Same.
  • Bicep: when rbacEnabled = false, the role-assignment resources are if(false) and Bicep drops dependency edges to skipped resources.
  • Terraform: depends_on on a resource address with count = 0 resolves to an empty collection, so the dependency is satisfied immediately.

Validation

  • az bicep build --file infra-bicep/infra/main.bicep — exit 0 (three pre-existing BCP037 warnings on modelProviderData only; runtime-valid property the Bicep type schema doesn't yet know about).
  • terraform fmt -check, terraform init -backend=false, terraform validate from infra-terraform/infra — all exit 0, "Success! The configuration is valid."

No new resources, no new variables, no new env-var contract.

When ASSIGN_RBAC=true, each model deployment now dependsOn both Foundry User and Foundry Project Manager role assignments on the Foundry account. The role-assignment PUT returns in ~5s but Foundry data-plane RBAC takes a few minutes to propagate; the slow model-deployment LRO (30s-20min) absorbs that wait, so the first claude -p / Python SDK call after azd up succeeds without retries.

Bicep and Terraform variants updated for parity. When ASSIGN_RBAC is false the role-assignment resources are if(false)/count=0 and the dependency edges are dropped, so there is no extra wait.
@achandmsft
Arun Sekhar (achandmsft) merged commit c262656 into main Jun 11, 2026
5 checks passed
@achandmsft
Arun Sekhar (achandmsft) deleted the rbac-before-deployments branch June 11, 2026 00:21
Arun Sekhar (achandmsft) added a commit that referenced this pull request Jun 11, 2026
…C=true

Replaces the two-role assignment (Foundry User + Foundry Project Manager) with a single Cognitive Services User assignment on the Foundry account. This is the smallest built-in role whose data actions cover Microsoft.CognitiveServices/accounts/MaaS/* (the Claude inference path).

Preserves the issue #38 / #39 serialization: all three Claude deployments still dependsOn the role-assignment resource, so the model-deployment LRO absorbs RBAC propagation lag.

Verified end-to-end with ASSIGN_RBAC=true: azd up succeeded, verifier 10/10 PASS including live claude -p round trip, python src/hello_claude.py succeeded on first call with no retries.

Closes #40.
Arun Sekhar (achandmsft) added a commit that referenced this pull request Jun 11, 2026
…C=true (#41)

Replaces the two-role assignment (Foundry User + Foundry Project Manager) with a single Cognitive Services User assignment on the Foundry account. This is the smallest built-in role whose data actions cover Microsoft.CognitiveServices/accounts/MaaS/* (the Claude inference path).

Preserves the issue #38 / #39 serialization: all three Claude deployments still dependsOn the role-assignment resource, so the model-deployment LRO absorbs RBAC propagation lag.

Verified end-to-end with ASSIGN_RBAC=true: azd up succeeded, verifier 10/10 PASS including live claude -p round trip, python src/hello_claude.py succeeded on first call with no retries.

Closes #40.

Co-authored-by: Arun Sekhar <achand@microsoft.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.

Serialize Claude model deployments after Foundry role assignments to absorb RBAC propagation lag

1 participant