Azure Container Apps Sandbox SDK for Python — data plane + sandbox group management. Community preview.
Project description
Azure Container Apps Sandbox Client Library for Python
⚠️ Preview — This SDK is in preview. The API surface may change without notice.
Data-plane and control-plane SDK for Azure Container Apps sandboxes.
Isolated MicroVMs
Secure, isolated compute environments with sub-second startup.
- Hardware-isolated microVM boundary — fully separated from host, platform, and other sandboxes
- Snapshot-based suspend/resume preserving full memory and disk state across sessions
- Per-sandbox network egress policy with deny-by-default posture for untrusted code
What you can build
- Traditional Apps. Lift-and-shift workloads that need stateful compute, custom kernels, or per-tenant isolation without rewriting.
- AI Apps & Agents. Persistent, isolated workspaces that survive across task boundaries. Suspend between turns, resume with full context.
- Code execution. Run untrusted code in seconds with strong isolation. Capture state with snapshots, replay deterministically.
- Dev environments. Per-user compute that scales from zero to hundreds on demand and preserves state across sessions.
- Many more… CI runners, browser automation, data prep, reproducible experiments — anywhere a fast, isolated VM helps.
Installation
pip install azure-containerapps-sandbox
Quick start
import uuid
from azure.identity import DefaultAzureCredential
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.authorization import AuthorizationManagementClient
from azure.containerapps.sandbox import (
SandboxGroupManagementClient,
SandboxGroupClient,
endpoint_for_region,
)
credential = DefaultAzureCredential()
subscription_id = "<your-subscription-id>" # az account show --query id -o tsv
principal_id = "<your-principal-id>" # az ad signed-in-user show --query id -o tsv
resource_group = "my-rg"
sandbox_group = "my-sandbox-group"
region = "eastus2"
# 1. Create resource group
resource_client = ResourceManagementClient(credential, subscription_id)
resource_client.resource_groups.create_or_update(resource_group, {"location": region})
# 2. Create sandbox group
mgmt = SandboxGroupManagementClient(
credential, subscription_id=subscription_id, resource_group=resource_group,
)
mgmt.create_group(sandbox_group, location=region)
# 3. Grant data-plane access
auth_client = AuthorizationManagementClient(credential, subscription_id)
scope = f"/subscriptions/{subscription_id}/resourceGroups/{resource_group}"
role_def = next(auth_client.role_definitions.list(
scope, filter="roleName eq 'Container Apps SandboxGroup Data Owner'"
))
auth_client.role_assignments.create(scope, uuid.uuid4(), {
"role_definition_id": role_def.id,
"principal_id": principal_id,
"principal_type": "User",
})
# 4. Connect to data plane and create a sandbox
client = SandboxGroupClient(
endpoint_for_region(region), credential,
subscription_id=subscription_id,
resource_group=resource_group,
sandbox_group=sandbox_group,
)
sandbox = client.begin_create_sandbox(disk="ubuntu").result()
# 5. Run a command
result = sandbox.exec("echo hello world && uname -a")
print(result.stdout)
# 6. Clean up
sandbox.delete()
mgmt.delete_group(sandbox_group)
client.close()
mgmt.close()
Authentication
Uses DefaultAzureCredential from azure-identity, which automatically
picks up az login, managed identity, environment variables, etc.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file azure_containerapps_sandbox-0.1.0b1.tar.gz.
File metadata
- Download URL: azure_containerapps_sandbox-0.1.0b1.tar.gz
- Upload date:
- Size: 46.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9fab23ccffab2ba732a49dcfc27eae833acc94bdc5a03794ed5be1f1225f3caa
|
|
| MD5 |
9f2578df897108b5063fb886ea3b861d
|
|
| BLAKE2b-256 |
cea85c39fb0eeae7fa2c86fbd7b0074d382070ab0331585a9c532fec7a0fbb5c
|
File details
Details for the file azure_containerapps_sandbox-0.1.0b1-py3-none-any.whl.
File metadata
- Download URL: azure_containerapps_sandbox-0.1.0b1-py3-none-any.whl
- Upload date:
- Size: 75.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: RestSharp/106.13.0.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73ff45154406e49798f14e84369385766332eeb2ebab6e74226f3170f67e7ea9
|
|
| MD5 |
b281dfdcab07c047647b941890342aed
|
|
| BLAKE2b-256 |
7242c7a6c7d3bdf9147ea995d2f25d8bddd3081fac2cc4ea42837b1989b40de8
|