Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

azure_containerapps_sandbox-0.1.0b2.tar.gz (47.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

azure_containerapps_sandbox-0.1.0b2-py3-none-any.whl (76.8 kB view details)

Uploaded Python 3

File details

Details for the file azure_containerapps_sandbox-0.1.0b2.tar.gz.

File metadata

File hashes

Hashes for azure_containerapps_sandbox-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 a269e92b5be204ba474607f7a4b26222c6e61103c5a809134ebf2682f38c070b
MD5 2d9e2df2b517b3da659fc33c444db502
BLAKE2b-256 0e87cb3e215021822f363380a0b801613a85f379b67e7ede699961f3cf69ef60

See more details on using hashes here.

File details

Details for the file azure_containerapps_sandbox-0.1.0b2-py3-none-any.whl.

File metadata

File hashes

Hashes for azure_containerapps_sandbox-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 b036420597f7c48cb9b70e4200c970b5059189d327ab1945ded8dc36ca1f2b2e
MD5 10981ea7100edc2f6054dc8623d3bc90
BLAKE2b-256 4f0ca71a5067dd4e1d3295fda1d05ff67bfa4ff31aa6aeffb24438df5c451d17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page