Skip to main content

Retrieve preview Bootstrap passwords

The optional Azure integration for #1445 copies the generated Bootstrap password directly from the VM into a shared Key Vault. See ADR-0277. No password is sent by mail or returned to GitHub Actions. The Runtime and product Vault resources do not depend on this integration. Docker/SSH are unchanged.

One-time preparation​

Create a Standard Key Vault in the dedicated preview resource group, with Azure RBAC, soft delete (at least seven days), and its public endpoint reachable from the VM and hosted runner. Do not enable template-deployment, disk-encryption or VM-deployment access flags. The configured maintainer vault is agentstration-previews in resource group agentstration-previews, West Europe.

Give human maintainers Key Vault Secrets User at the vault. They also need control-plane Reader access to navigate the portal (existing resource-group administrators already have it).

Use an authorized Azure administrator to prepare the deployment principal. Its existing VM operator/Blob roles are insufficient. The renderer connects to no service and creates no Azure resources:

python3 scripts/preview/key_vault_setup.py \
--subscription 8c045fb3-fc2f-44e5-bb51-75774f471b13 \
--resource-group agentstration-previews \
--vault agentstration-previews \
--principal-id YOUR_GITHUB_FEDERATED_SERVICE_PRINCIPAL_OBJECT_ID \
--output /tmp/preview-key-vault-roles

Use the enterprise application's service principal Object ID, not the app's client ID or app-registration Object ID. It is the principal already assigned Agentstration Preview VM Operator. Review the four rendered JSON files:

  • credential-slot-role.json: an ARM role definition granting vault/secret metadata read and placeholder write, plus soft deletion. It grants no secret-value read and no role assignment.
  • slots-assignment.json: that role assigned at the exact shared vault only.
  • delegation-assignment.json: Key Vault Data Access Administrator, at that same vault, further conditioned to Secrets Officer and ServicePrincipal targets on assignment write and delete. The role does not grant secret-value reads.
  • operations.json: ordered ARM PUT endpoints for the definition and those two assignments.

After reviewing them, apply through an administrator's Azure session:

python3 - <<'PY'
import json, pathlib, subprocess
root = pathlib.Path('/tmp/preview-key-vault-roles')
definition_id = None
for item in json.loads((root / 'operations.json').read_text()):
body = root / item['body']
if item['body'] == 'slots-assignment.json':
payload = json.loads(body.read_text())
payload['properties']['roleDefinitionId'] = definition_id
body.write_text(json.dumps(payload))
result = json.loads(subprocess.check_output(['az', 'rest', '--method', 'put', '--url', item['url'],
'--body', '@' + str(body), '--output', 'json'], text=True))
if item['body'] == 'credential-slot-role.json':
definition_id = result['id']
print('Applied:', item['body'])
PY

Definition and assignment UUIDs are deterministic. The ARM PUTs can be replayed; the returned canonical definition ID is used for its assignment. Do not substitute az role definition create: that command generates a new UUID even when JSON supplies an Id, breaking the prepared references. If a manually created role already has this name with another UUID, review that existing definition before applying this bootstrap. Do not add unconditioned RG/subscription Owner or User Access Administrator to the deployment principal. It is trusted main deployment tooling and manages all preview slots; individual VM principals are restricted to one secret each.

Allow role propagation. Finally create this variable, not a secret, under GitHub Settings > Environments > preview-deployment > Environment variables:

AZURE_PREVIEW_KEY_VAULT=agentstration-previews

Enable it only after preparation. Merge the trusted tooling PR before testing; preview PRs cannot change the deployment scripts. Run a new /preview deploy on a PR selecting a GUID Bootstrap profile. Existing running previews do not acquire a credential export just because a GitHub variable changes.

Retrieve on a phone​

After publication, the preview card provides Retrieve the Bootstrap password in Azure Key Vault and a secret name such as pv-pr-1441-<installation-owner>-admin-password. Open the vault link, select that secret and its current version, then select Show Secret Value and use the portal copy control. Authenticate with the authorized Entra account. A link grants no RBAC permission. The Nantes composition uses local username admin; other profiles own their own account declarations.

This is the generated initial Bootstrap password, not a password-reset service. Changing a local account password in Agentstration does not synchronize Key Vault. Do not paste credentials into PR comments, workflow output or issue reports.

Optional private email notification​

#1448 optionally sends the verified preview URL and Key Vault retrieval reference by authenticated SMTP. The mail contains the secret name, never the password or an Azure token. The existing VM-to-Key-Vault publication is unchanged; recipients still need Entra authentication and Key Vault permission. See ADR-0278.

Configure these environment variables in protected preview-deployment:

VariableValue
PREVIEW_EMAIL_ENABLEDtrue to opt in; empty or false retains portal references in existing public feedback
PREVIEW_SMTP_HOSTSMTP hostname supplied by the mail provider, without a URL scheme
PREVIEW_SMTP_PORTProvider's submission port, commonly 465 or 587
PREVIEW_SMTP_TLSssl for implicit TLS, or starttls for mandatory STARTTLS
PREVIEW_SMTP_FROMSender mailbox address, for example notifications@example.test

Configure these environment secrets in that same environment:

SecretValue
PREVIEW_SMTP_USERNAMEProvider's authenticated SMTP username
PREVIEW_SMTP_PASSWORDMailbox SMTP password, entered directly into GitHub
PREVIEW_EMAIL_RECIPIENTSOne to ten distinct mailbox addresses separated by commas; no display names or line breaks

Use the host, port and TLS combination documented for the actual mailbox offer; SMTP is provider-neutral, not tied to OVH. Outbound submission requires a valid server certificate and never falls back to plaintext. Authentication/recipient configuration is taken only from the protected environment, not PR content. The deployment process temporarily removes all mail settings from its environment before any provider subprocess/guest work, then restores them for later actions. No mail settings are added to application configuration, requests or OCI images.

Both manual and automatic Azure deploys use the same notification boundary. Only a verified URL with a confirmed host credential-publication receipt can trigger a message, including protected administration when Bootstrap is still incomplete. Status/destroy/validation and dry-run reconciliation send nothing. An explicit preserving /preview deploy requests another notification. No automatic SMTP retry is performed, because retrying an uncertain handoff can duplicate messages. Each SMTP operation has a 20-second socket timeout.

When email is enabled, newly returned lifecycle results, artifacts and public comments omit the credential reference. Feedback reports email-submitted only after all configured recipients were accepted by SMTP; this does not prove inbox delivery. Check spam folders and the provider's delivery facilities separately. Invalid configuration or SMTP failure reports email-failed, withholds the reference and leaves the actual preview availability unchanged. A later status reports the configured email route without claiming a past message was sent. There is no fallback that republishes the Key Vault reference after mail failure.

This reduces disclosure of the retrieval reference; it does not conceal all infrastructure metadata. Existing public comments, logs/artifacts and repository history are not scrubbed, and ordinary provider resource IDs remain in technical results. Removing this option restores the default portal-reference behavior.

Validation before enabling live use: configure an authorized recipient directly in GitHub, merge the trusted tooling, explicitly request a deploy, confirm the notification and RBAC-protected retrieval, then verify a status sends no mail. Offline tests use fake SMTP transports and never send real email. Live delivery requires a separate maintainer confirmation.

Lifecycle and failure behavior​

The host generates the password in its existing protected configuration and writes it directly to its own secret using a system-assigned identity. The CI only prepares disabled public placeholders, manages scoped assignments, and receives a boolean publication receipt. The host blocks container IMDS traffic before assigning roles. Bridge workloads are fenced in FORWARD; pinned, owned Caddy/cloudflared host-network containers run as dedicated UID 10001 and are fenced in OUTPUT. Their token/config mounts remain private and readable by that UID; no Azure token is passed to either container. Owned legacy root access containers are retired before the identity receives a role. Privileged, host-PID, unapproved host-network and network/kernel-capability containers are rejected; the existing AEP DAC_OVERRIDE file-read capability remains supported. The guard is installed before Docker restarts and rechecked on deployment/status. Identity/RBAC propagation retries are bounded to ten minutes. Token/secret HTTP requests use neither proxies nor redirects.

Preserving deploy keeps the password/name. Full destroy, TTL, PR-close cleanup and explicit redeploy revoke the owned assignment, remove the VM, replace the latest value with a disabled public marker to keep the DELETE response credential-free, soft-delete the owned secret. Old versions follow the vault's soft-delete retention; no purge is performed. New installations use a new random owner/name. Preserve-destroy retains the secret along with the disk and account identity.

Foreign ownership, unexpected identities, unconfirmed guard/publication and RBAC failures are fatal. Failed cleanup remains pending and retryable. A failed credential export does not mark deploy successful; an otherwise verified administrative route can remain available for diagnosis. No secret link is shown without a guest publication receipt. Status/destroy use the recorded vault, including when the environment variable was removed; changing an active vault requires explicit reset. The shared vault is never removed by preview cleanup.

Validation​

Offline tests cover disabled behavior, invalid configuration, ownership/identity drift, guard-before-role ordering, per-secret scopes, receipt handling, current guest/lifecycle relay, reset/recreation, soft deletion and safe feedback. The credential-isolation CI job also runs python3 scripts/preview/credential_guard_smoke.py: it sends real forwarded and host-network-UID packets through the production guard inside a disposable Docker network namespace, confirms the root publisher is not blocked, then repairs deliberately disrupted rules and repeats. Its dummy IMDS route cannot reach a real metadata service. This smoke requires Docker and public Alpine package downloads, but no Azure/GHCR credentials; it is separate from the offline functional test suite. The existing pinned Caddy HTTP/WebSocket and cloudflared configuration smoke also runs as UID 10001, retaining credential stripping and application auth. Before claiming live qualification, record protected-main run evidence for:

  1. Deploy a GUID profile and retrieve its password with the authorized human account; sign in without copying it into logs or comments.
  2. Prove a running application container cannot reach IMDS, while the host can publish. Repeat after a VM/Docker restart, checking the live forwarding rule.
  3. Deploy another isolated preview and prove each identity is denied access to the other's secret. Never print a token or any secret value in this check.
  4. Preserve-deploy and verify the password/account remains usable. Destroy one preview, confirm its secret is soft-deleted and assignment removed, and verify the other preview and shared vault remain usable.
  5. Recreate the first preview with a new secret name. Exercise a publication or cleanup failure and confirm there is no false success or unowned deletion.

Live Azure qualification is pending the trusted-main merge and administrator setup; offline tests alone do not establish these external access guarantees.

Azure CLI REST failures use HTTP-reason wrappers such as Not Found({...}). The adapter retains only bounded structured error codes from these bodies. Only explicit missing-resource codes allow a secret slot or role assignment to be created; authorization failures, unknown codes and malformed responses remain fatal. Raw provider messages, targets and response values are never exported.