Guide
Interactive shell
An interactive shell is a terminal session inside a running sandbox. Use it when you need to inspect a disk image, debug a failed run, or try commands before you script them.
Connect from the portal
The portal opens a streaming console to the selected sandbox. Use it for manual debugging sessions.
- Open sandboxes.azure.com/sandbox-groups and select your sandbox group.
- Select Sandboxes.
- Select a running sandbox.
- Run commands in the streaming console. Type
exitor close the console when you are done.
- Bash
- PowerShell
aca sandbox create --disk ubuntu --label name=demo-shell
aca sandbox shell -l name=demo-shell
aca sandbox create --disk ubuntu --label name=demo-shell
aca sandbox shell -l name=demo-shell
Create a sandbox and open a shell
Use this flow for a throwaway debugging sandbox. Delete the sandbox when the shell closes.
- Open your sandbox group and select Sandboxes.
- Select Create.
- Pick the
ubuntudisk image and select Create. - Open the new sandbox, and run commands.
- Select Delete when the debugging session is complete.
- Bash
- PowerShell
aca sandbox create --disk ubuntu --label name=demo-shell
aca sandbox shell -l name=demo-shell
aca sandbox delete -l name=demo-shell --yes
aca sandbox create --disk ubuntu --label name=demo-shell
aca sandbox shell -l name=demo-shell
aca sandbox delete -l name=demo-shell --yes
Choose shell or exec
Use shell for a live terminal. Use exec when automation needs one command and captured output.
SDK shell support
The Python SDK exposes sandbox.exec(...) for one-shot commands. It does not expose a PTY shell API. For an interactive shell from Python, invoke aca sandbox shell.
- Bash
- PowerShell
- SDK
aca sandbox exec -l name=demo-shell -c "whoami"
aca sandbox shell -l name=demo-shell
aca sandbox exec -l name=demo-shell -c "whoami"
aca sandbox shell -l name=demo-shell
result = sandbox.exec("whoami")
print(result.stdout)
| You want to | Use |
|---|---|
| Run one command and capture output | aca sandbox exec or sandbox.exec(...) |
| Try commands by hand | aca sandbox shell or portal |
| Run a terminal editor | aca sandbox shell or portal |
| Pipe a script non-interactively | aca sandbox exec |