Skip to main content

ADR-0277: Preview Bootstrap passwords use host-scoped Key Vault delivery

Status: Proposed — 2026-11-28

Context​

#1445 makes generated preview Bootstrap passwords retrievable from a mobile Azure portal. Cloud Shell output is difficult to copy on a phone. Mail would retain reusable credentials outside the deployment boundary. ADR-0257 currently forbids VM identities and role assignment by the deployment operator.

Decision​

Add an optional external Azure adapter capability, enabled by the protected environment variable AZURE_PREVIEW_KEY_VAULT. Use a pre-created shared Standard vault with Azure RBAC and soft delete in the dedicated preview resource group. Only GUID Bootstrap installations create a credential slot. Without this option, VMs retain identity None; Docker/SSH and the Runtime acquire no Azure dependency.

Each installation uses its random lifecycle owner UUID in the secret name. Preserving updates keep that owner and the private host password. Full reset creates a new owner/name, avoiding reuse of soft-deleted names. Store only the vault/secret identifiers and VM principal in the existing ownership record.

Before granting a VM any role, a bounded Managed Run Command installs a host firewall guard. The first FORWARD rule jumps to DOCKER-USER; its first rule drops traffic to IMDS (169.254.169.254). Caddy and cloudflared intentionally use the host network: in credential mode they run as dedicated UID/GID 10001, with all capabilities dropped and no privilege escalation. The first host OUTPUT rule denies that UID access to IMDS. Stop owned legacy root access containers before granting any role; the normal lifecycle recreates them under the fenced UID with narrowly readable configuration mounts. A Docker systemd ExecStartPre installs both guards before daemon/container restarts. Reject privileged, host-PID and unapproved host-network containers. Application containers retain only the existing DAC_OVERRIDE added capability needed for mounted AEP keys; network/kernel-administration capabilities are rejected. Recheck rules, pinned infrastructure images, owner and process UID before publication/status. The root host publisher can still obtain its own managed identity token.

Give the system-assigned VM principal Key Vault Secrets Officer at its exact secret scope, never at vault scope. The host writes the already-generated Bootstrap password directly to that slot using IMDS. Disable proxy use and HTTP redirects, bound propagation retries, and keep all token/secret responses in the host process. A private receipt binds the successful publication to the context and password hash. Public results contain only a validated portal reference after the guest confirms publication. Password delivery failure must not falsely mark deployment successful or prevent otherwise verified administrative access.

Provisioning uses a separate vault-scoped role to create a disabled public placeholder through ARM, whose secret metadata API never returns the value. A vault-scoped Key Vault Data Access Administrator assignment additionally restricts delegation to Secrets Officer and ServicePrincipal targets for both creation and deletion. This does not broaden the ordinary VM operator role. Trusted main tooling remains the authority across previews; VMs cannot delegate roles and receive no permissions on another installation's slot.

Full cleanup audits ownership, revokes its exact assignment while the principal still exists, removes the VM/infrastructure, then soft-deletes only its slot. Before the data-plane DELETE, replace the current secret version through ARM with a disabled public marker: the DELETE response can include the latest secret value and must not carry a generated password back to CI. Never purge the vault or its deleted objects. Retain pending deletion metadata until cleanup converges; retries are idempotent. Preserve-destroy keeps credentials with the retained disk/application identity.

This is a narrow opt-in exception to ADR-0257's no-system-identity and no-delegation rules, with host isolation and vault-scoped administration. Registry credentials, cloud optionality, closed ingress and Cloudflare/Entra protection remain unchanged.

Consequences​

An Azure administrator must apply the rendered, reviewable roles before enabling the variable. No shared application credential or vault is created by Agentstration. Humans need Key Vault Secrets User; a GitHub link itself grants no access. The reference is the initial Bootstrap password: changing the account password inside the application does not rotate the stored Bootstrap value.

Offline tests exercise ownership, exact scopes, persistent guard rules, real guest/lifecycle relay, failure receipts, reset/recreation and secret-free feedback. Live acceptance must additionally prove container IMDS denial after a VM restart, human retrieval, and inability of one preview identity to read another slot.