fix(up): idempotent AKS RBAC role assignments + Docker not required for --release (v0.1.15)#452
Merged
Conversation
…or --release (v0.1.15) RoleAssignmentUpdateNotPermitted: aks.bicep named role assignments guid(<resource>.id, ...) — stable across identity rotation. When the AKS kubelet identity rotates (cluster recreate, e.g. --from-scratch) or the sandbox UAMI is recreated with the same name, the GUID stayed constant but the principalId changed → ARM tried to UPDATE an existing assignment's principal and failed the whole deploy. Fix: new modules/sandbox-rbac.bicep takes principalIds as STRING params (legal in a roleAssignment name, unlike a runtime reference() — BCP120) and names each guid(scope, principalId, roleDefId). A rotated identity now yields a new name → clean CREATE instead of conflicting UPDATE. Every role, principal, and scope is preserved exactly. main.json recompiled in sync. Also: kars up --release no longer requires Docker. Preflight auto-enabled build=true whenever a repo Dockerfile existed, without excluding --release — but release mode only az-acr-imports published images (no local build). Now skips the auto-build + Docker requirement when --release is set. Security audit: docs/internal/security-audits/2026-06-25-rbac-idempotency-docker-preflight.md (2 sign-offs). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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.
Blocker:
RoleAssignmentUpdateNotPermittedonkars upaks.bicepnamed its role assignmentsguid(<resource>.id, …)— stable across an identity rotation. When the AKS kubelet identity rotates (fresh objectId on cluster recreate, e.g.--from-scratchafter a teardown) or the sandbox UAMI is recreated with the same name, the GUID stayed constant but theprincipalIdchanged, so ARM tried to update an existing assignment's principal →RoleAssignmentUpdateNotPermitted("principal ID … not allowed to be updated"), failing the whole deploy.Fix
New
modules/sandbox-rbac.bicepreceives the principalIds as string params — legal in a roleAssignmentname, unlike a runtimereference()(Bicep BCP120, which is why the obvious inline fix doesn't compile) — and names each assignmentguid(scope, principalId, roleDefId). A rotated identity now yields a new name → a clean CREATE instead of a conflicting UPDATE.Every role, principal, and scope is preserved exactly (kubelet AcrPull @ RG; sandbox AcrPull @ ACR; OpenAI User @ AOAI; KV Secrets User @ KV; MI Contributor @ UAMI).
main.jsonrecompiled in sync.Also:
kars up --releasewrongly required DockerPreflight auto-set
build=truewhenever a repo Dockerfile existed (dev-mode detection) without excluding--release— so running from a clone demanded Docker even though release mode onlyaz acr imports published images (no local build). Fixed to skip the auto-build + Docker requirement under--release.Verification
az bicep build --file deploy/bicep/main.bicepcompiles clean (validates the module'sexisting/scope wiring + BCP120-safe names);main.jsonregenerated.tsc+ oxlint clean; 821 vitest pass.dist/deploy/bicep/modules/).docs/internal/security-audits/2026-06-25-rbac-idempotency-docker-preflight.md(2 sign-offs).Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com