You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/container-apps/sessions-usage.md
+9-14Lines changed: 9 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ Authorization: Bearer <TOKEN>
54
54
55
55
This request is forwarded to the container in the session with the identifier for the user's ID.
56
56
57
-
If the session isn't already running, Azure Container Apps automatically allocates a session from the pool before forwarding the request.
57
+
If no session exists for the given identifier, Azure Container Apps automatically allocates one from the pool before forwarding the request.
58
58
59
59
In this example, the session's container receives the request at `http://0.0.0.0:<INGRESS_PORT>/<API_PATH_EXPOSED_BY_CONTAINER>`.
60
60
@@ -78,31 +78,26 @@ The identifier must be a string that is 4 to 128 characters long and can contain
78
78
79
79
## Security
80
80
81
+
### Security model
82
+
81
83
Dynamic sessions are built to run untrusted code and applications in a secure and isolated environment. While sessions are isolated from one another, anything within a single session, including files and environment variables, is accessible by users of the session.
82
84
83
85
Only configure or upload sensitive data to a session if you trust the users of the session.
84
86
87
+
### Network access
88
+
85
89
By default, sessions are prevented from making outbound network requests. You can control network access by configuring network status settings on the session pool.
86
90
87
-
-**Use strong, unique session identifiers**: Always generate session identifiers that are long and complex to prevent brute-force attacks. Use cryptographic algorithms to create identifiers that are hard to guess.
91
+
### Best practices
88
92
93
+
-**Secure identifiers**: Use secure [session identifiers](sessions-usage.md#identifiers) at all times. Generate session identifiers using cryptographic methods to ensure unique and unpredictable values. Avoid using sequential IDs that could be guessed by an attacker.
94
+
-**Use HTTPS**: Always use HTTPS to encrypt data in transit. This protects session identifiers and any sensitive data exchanged between the client and server from being intercepted.
95
+
-**Limit session lifetime**: Implement timeouts for sessions. For instance, allow a maximum of 15 minutes of inactivity before the session is automatically terminated. This helps mitigate risks due to a lost or unattended device.
89
96
-**Limit session visibility**: Set strict access controls to ensure that session identifiers are only visible to the session pool. Avoid exposing session IDs in URLs or logs.
90
-
91
-
-**Implement short expiration times**: Configure session identifiers to expire after a short period of inactivity. This approach minimizes the risk of sessions being hijacked after a user has finished interacting with your application.
92
-
93
97
-**Regularly rotate session credentials**: Periodically review and update the credentials associated with your sessions. Rotation decreases the risk of unauthorized access.
94
-
95
-
-**Utilize secure transmission protocols**: Always use HTTPS to encrypt data in transit, including session identifiers. This approach protects against man-in-the-middle attacks.
96
-
97
98
-**Monitor session activity**: Implement logging and monitoring to track session activities. Use these logs to identify unusual patterns or potential security breaches.
98
-
99
99
-**Validate user input**: Treat all user input as dangerous. Use input validation and sanitation techniques to protect against injection attacks and ensure that only trusted data is processed.
100
100
101
-
To fully secure your sessions, you can:
102
-
103
-
-[Use Microsoft Entra ID authentication and authorization](#authentication)
### <aname="authentication"></a>Authentication and authorization
107
102
108
103
When you send requests to a session using the pool management API, authentication is handled using Microsoft Entra tokens. Only Microsoft Entra tokens from an identity belonging to the *Azure ContainerApps Session Executor* role on the session pool are authorized to call the pool management API.
Copy file name to clipboardExpand all lines: articles/container-apps/sessions.md
+13-17Lines changed: 13 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,6 @@ With sessions, you get:
26
26
-**Instant Startup**: Prewarmed pools enable subsecond launch times for interactive workloads. New sessions are allocated in milliseconds thanks to pools of ready but unallocated sessions.
27
27
-**Scalable by Design**: Handle hundreds or thousands of concurrent sessions without manual intervention.
28
28
-**Managed lifecycle**: Sessions are automatically deprovisioned after use or after a configurable cooldown period, ensuring efficient resource usage.
29
-
-**Simple Access**: Sessions are accessed through a REST API with a unique identifier. If a session doesn’t exist, a new one is automatically allocated.
30
-
-**API Access**: Sessions are exposed to your application via a single HTTP endpoint.
31
29
32
30
33
31
## Common Scenarios
@@ -46,30 +44,26 @@ Dynamic sessions are useful in a variety of situations, including:
46
44
-**Session**
47
45
A session is the actual execution environment where your code or container runs. Sessions are ephemeral and isolated, designed for short-lived tasks. When you create a session, it's allocated from the session pool, ensuring fast startup. After the task completes or the cooldown period expires, the session is destroyed and resources are cleaned up.
48
46
49
-
-**Session Lifecycle**
50
-
Sessions follow a clear flow from creation to cleanup:
47
+
-**Session Lifecycle**
48
+
When your application sends a request with a session identifier, the session pool allocates a session automatically. The session stays active as long as requests continue. Once the cooldown period expires with no activity, the session is destroyed and its resources are cleaned up automatically.
51
49
52
-
1.**Request Received**: Your application calls the REST API to create or retrieve a session using a unique identifier.
53
-
2.**Pending**: The system validates the request and checks for available resources.
54
-
3.**Unallocated**: A session exists but isn't yet assigned to a workload. If a prewarmed session is available in the pool, it moves quickly to allocation.
55
-
4.**Allocated**: The session becomes active and runs your code or container. This is the execution phase.
56
-
5.**Destroyed**: After the task completes or the cooldown period expires, the session is terminated and resources are cleaned up automatically.
50
+
-**Request routing and identifiers**
51
+
Sessions are accessed through the session pool management endpoint. Requests include an `identifier` query parameter, and the pool routes the request to an existing session or allocates a new one if needed. The request path after the management endpoint is forwarded to the session container.
57
52
58
-
This lifecycle ensures fast startup, efficient resource use, and automatic cleanup without manual intervention.
53
+
-**Session Pool Types**
54
+
-**Code Interpreter Session Pools**: These use platform built-in containers that provide preconfigured environments for running code, including AI-generated scripts. Ideal for scenarios like LLM-driven workflows or secure code execution.
55
+
-**Custom Container Session Pools**: Bring-your-own-container for custom workloads that require specific dependencies or runtime environments.
59
56
60
-
-**Session Types**
61
-
-**Code Interpreter Sessions**: These are platform built-in containers that provide preconfigured environments for running code, including AI-generated scripts. Ideal for scenarios like LLM-driven workflows or secure code execution.
62
-
-**Custom Container Sessions**: Bring-your-own-container for custom workloads that require specific dependencies or runtime environments.
|**Best For**| Running AI‑generated code, user-submitted scripts, or quick secure code execution without managing a runtime environment. | Workloads requiring a custom runtime, libraries, binaries, or specialized tools not supported by built-in interpreters. |
70
63
|**Environment**| Preconfigured with common runtimes and tools; no container build or image publishing required. | Fully customizable container image with your own dependencies, packages, and configuration. |
71
64
|**When to Choose**| Choose this for simplicity, fastest startup, and minimal setup. | Choose this when you need full control over the execution environment or rely on custom dependencies. |
72
65
|**Ideal Use Cases**| LLM workflows, code interpretation, educational/sandbox scenarios, safe execution of user code. | Custom compute tasks, proprietary interpreters, specialized environments, or workloads with specific OS/library requirements. |
66
+
|**Language and protocol**| Limited to the built-in runtimes and the REST API surface provided by the code interpreter. | Any language or stack supported by your container, with any TCP protocol you choose to expose. |
73
67
|**Image Requirement**| None—uses platform built‑in interpreter environments. | Required—supply your own container image URI. |
74
68
75
69
For more information, see [Usage](./sessions-usage.md).
@@ -94,6 +88,8 @@ Dynamic sessions are available in the following regions. Both code interpreter a
94
88
| West US 3 | UK West |||
95
89
|| West Europe |||
96
90
91
+
> [!NOTE]
92
+
> Regional availability may change. To verify current availability, check the **Location** dropdown when creating a session pool in the Azure portal.
97
93
98
94
## Security
99
95
Dynamic sessions are designed to run untrusted code in isolated environments. For information about securing your sessions, see [Security](./sessions-usage.md#security).
@@ -105,5 +101,5 @@ Custom container sessions are billed based on the resources consumed by the sess
105
101
106
102
## Next Steps
107
103
- Learn how to configure [Session pools](./session-pool.md)
108
-
- Learn how to use [Dynamic sessions](./sessions-usage.md)
104
+
- Learn how to use [Dynamic sessions](./sessions-usage.md), including security and best practices
0 commit comments