|
| 1 | +--- |
| 2 | +name: sandboxes |
| 3 | +description: | |
| 4 | + Sandboxes — hardware-isolated microVMs on Azure Container Apps for |
| 5 | + running AI-generated code, coding agents, MCP servers, web apps, and |
| 6 | + ephemeral workloads. Snapshot/resume, scale-to-zero, sub-second |
| 7 | + startup, deny-default egress. Driven by the `aca` CLI (auth delegates |
| 8 | + to `az login`). |
| 9 | +
|
| 10 | + Use when the user wants to: create or manage sandbox groups and |
| 11 | + sandboxes; exec commands or open an interactive shell; read/write |
| 12 | + files; expose ports; snapshot, stop, resume, commit to a disk, or |
| 13 | + mount volumes; tighten egress; manage secrets, managed identity, |
| 14 | + labels; apply YAML specs; or run scenarios like web apps, coding |
| 15 | + agents, code interpreter, swarms, sandbox inception, computer-use, |
| 16 | + MCP hosting, data processing, or developer workflows. |
| 17 | +
|
| 18 | + Triggers: "create sandbox", "sandbox group", "aca cli", "aca |
| 19 | + sandbox", "azure container apps sandbox", "ACA sandbox", "microVM", |
| 20 | + "isolated VM", "run untrusted code", "exec in sandbox", "sandbox |
| 21 | + shell", "copy files to sandbox", "sandbox port", "sandbox snapshot", |
| 22 | + "commit sandbox to disk", "sandbox volume", "mount volume sandbox", |
| 23 | + "suspend sandbox", "resume sandbox", "sandbox lifecycle", |
| 24 | + "auto-suspend sandbox", "sandbox secret", "sandbox managed identity", |
| 25 | + "sandbox labels", "sandbox apply yaml", "egress deny", "egress |
| 26 | + allow-list", "code interpreter", "agent swarm", "sandbox inception", |
| 27 | + "coding agent sandbox", "computer use sandbox", "host mcp". |
| 28 | +--- |
| 29 | + |
| 30 | +# Sandboxes |
| 31 | + |
| 32 | +Hardware-isolated microVMs on Azure Container Apps. Snapshot/resume, |
| 33 | +scale-to-zero, sub-second startup, deny-default egress. This skill |
| 34 | +drives sandboxes through the **`aca` CLI** — one command surface, no |
| 35 | +ambiguity. Self-contained — everything is under `references/` in this |
| 36 | +folder. |
| 37 | + |
| 38 | +## What it is |
| 39 | + |
| 40 | +- **Resource type:** `Microsoft.App/SandboxGroups` (preview). |
| 41 | +- **Isolation:** each sandbox is its own microVM, safe for untrusted code. |
| 42 | +- **Startup:** sub-second from a prewarmed pool; suspend/resume preserves |
| 43 | + full memory + disk. |
| 44 | +- **Scale:** zero to thousands; pay nothing when idle. |
| 45 | +- **Auth:** `aca` delegates to `az login` — same identity, same MFA. |
| 46 | + |
| 47 | +> ⚠️ **The `az` CLI has no sandbox commands.** Sandbox groups and |
| 48 | +> sandboxes are managed by `aca` — **not** by `az containerapp …`. The |
| 49 | +> `az containerapp` commands are for the older Apps / Jobs surface and |
| 50 | +> do not touch sandboxes. If you see `az containerapp sandbox …` in a |
| 51 | +> snippet, it's wrong. |
| 52 | +
|
| 53 | +## Get started |
| 54 | + |
| 55 | +| | Where | |
| 56 | +|---|---| |
| 57 | +| **Install** | [references/install.md](references/install.md) | |
| 58 | +| **Prerequisites** | [references/prerequisites.md](references/prerequisites.md) | |
| 59 | +| **Quick start** | [references/quickstart.md](references/quickstart.md) | |
| 60 | +| **Full CLI reference** | [references/reference.md](references/reference.md) | |
| 61 | +| **Scenario recipes** | [references/scenarios.md](references/scenarios.md) | |
| 62 | + |
| 63 | +After install, always confirm setup with `aca doctor` — it resolves |
| 64 | +subscription / RG / group / region / role and tells you which check |
| 65 | +is red. |
| 66 | + |
| 67 | +## Capabilities |
| 68 | + |
| 69 | +Everything the platform exposes. Each row is the starting point — open |
| 70 | +[references/reference.md](references/reference.md) for full flags and |
| 71 | +options. |
| 72 | + |
| 73 | +> Command rows below show only the **shape**. In real invocations: |
| 74 | +> - every `aca sandbox <verb>` takes `--id <sandbox-id>`; |
| 75 | +> - every `aca sandboxgroup <noun> <verb>` mutation takes `--name <group>` |
| 76 | +> (or relies on the default group set via `--set-config`); |
| 77 | +> - omit these from copies into the shell and you'll get a CLI parse error. |
| 78 | +
|
| 79 | +| # | Capability | What it does | `aca` CLI | |
| 80 | +|----|---------------------------|------------------------------------------------------------------------------|-----------| |
| 81 | +| 00 | **Sandbox groups** | Provision, list/get, assign Data Owner role, tear down. | `aca sandboxgroup create / list / get / role create / delete` | |
| 82 | +| 01 | **Sandboxes** | Create, list, get, delete; cpu/memory/labels/env; parallel. | `aca sandbox create / list / get / delete` (+ `--cpu --memory --labels --env`) | |
| 83 | +| 02 | **Snapshots** | Freeze a running sandbox; boot new ones from that point. | `aca sandbox snapshot --id <id> --name X` · `aca sandbox create --snapshot X` | |
| 84 | +| 03 | **Disks** | Public disks, build from container image, commit a running sandbox. | `aca sandboxgroup disk list-public / create --image` · `aca sandbox commit --id <id> --name X` · `aca sandbox create --disk <public-name>` (or `--disk-id <id>` for private/committed disks) | |
| 85 | +| 04 | **Volumes** | `AzureBlob` (shared) or `DataDisk` (block); mount at create or post-create. | `aca sandboxgroup volume create --type AzureBlob` · `aca sandbox mount --volume X --path /mnt/x` | |
| 86 | +| 05 | **Lifecycle** | Stop/resume; auto-suspend after idle; auto-delete after TTL. | `aca sandbox stop / resume` · `aca sandbox lifecycle set --auto-suspend 60` | |
| 87 | +| 06 | **Ports** | Expose an HTTP port; anonymous or Entra-gated; revoke. | `aca sandbox port add --port 8080 [--anonymous]` · `port list / remove` | |
| 88 | +| 07 | **Files** | write / read / list / stat / mkdir / delete inside the sandbox. | `aca sandbox fs write --file ./local` · `fs cat / ls` · `fs cp <src> <dst>` (positional, `sbx-id:/path` syntax) | |
| 89 | +| 08 | **Egress** | Deny-default outbound + host allow-list; audit decisions; YAML transforms. | `aca sandbox egress set --default Deny --host-allow "*.host.com"` · `egress show / decisions / apply` | |
| 90 | +| 09 | **Secrets** | Group-scoped key/value, fetched at runtime from inside the sandbox. | `aca sandboxgroup secret upsert --name X --values "K=V"` · `secret list / delete` | |
| 91 | +| 10 | **Managed identity** | System- or User-assigned MI on the group; grant RBAC for cross-group orchestration. | `aca sandboxgroup identity assign --system-assigned` (or `--user-assigned <res-id>`) · `identity show / remove` | |
| 92 | +| 11 | **Labels & selectors** | `--labels k=v` at create time; AND-filter on list. Fleet management pattern. | `aca sandbox create --labels role=worker,tenant=t42` · `aca sandbox list -l role=worker` | |
| 93 | +| 12 | **Interactive shell** | Real PTY into a running sandbox. | `aca sandbox shell --id <id>` | |
| 94 | +| 13 | **YAML spec / `apply`** | Declarative infra-as-code: `init`, `validate`, `apply`, `schema`. | `aca sandbox init > sandbox.yaml` · `validate` · `apply --file sandbox.yaml` | |
| 95 | +| 14 | **`aca doctor`** | Diagnose subscription / RG / group / region / role. | `aca doctor` | |
| 96 | + |
| 97 | +## Scenarios |
| 98 | + |
| 99 | +Composed patterns that combine the capabilities above. Full sketches |
| 100 | +in [references/scenarios.md](references/scenarios.md). |
| 101 | + |
| 102 | +- **Web apps** — start a server, expose a port anonymously, hit the URL. |
| 103 | +- **Coding agents in a sandbox** — run Copilot CLI / Claude Code / Codex |
| 104 | + with deny-default egress and (optionally) token-swap rules. |
| 105 | +- **Code interpreter** — LLM generates → exec → observe → iterate; |
| 106 | + snapshot between turns for rewind. |
| 107 | +- **Swarms** — orchestrator fans work across N worker sandboxes by |
| 108 | + label selector. |
| 109 | +- **Sandbox inception** — orchestrator runs *inside* a sandbox and uses |
| 110 | + its managed identity to drive a separate worker group. No credentials |
| 111 | + in agent code. |
| 112 | +- **Computer-use** — LLM drives a real browser; watch live via noVNC. |
| 113 | +- **MCP hosting** — host an MCP server in a sandbox; expose via port or |
| 114 | + Dev Tunnel. |
| 115 | +- **Data processing** — producer/consumer pipelines on shared |
| 116 | + `AzureBlob` volumes. |
| 117 | +- **Developer workflows** — PR builds, ephemeral CI, on-demand dev envs. |
| 118 | + |
| 119 | +## Python SDK (separate) |
| 120 | + |
| 121 | +An early-access Python SDK (`azure-containerapps-sandbox`) is also |
| 122 | +available if you'd rather drive sandboxes from service code instead of |
| 123 | +the CLI. It is **out of scope for this skill** — when the user asks for |
| 124 | +Python, point them at the upstream README and stop: |
| 125 | + |
| 126 | +> https://github.com/microsoft/azure-container-apps/blob/main/docs/early/python-sdk/README.md |
| 127 | +
|
| 128 | +Mixing CLI and SDK in the same answer confuses things. Pick one. |
0 commit comments