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
In addition to the built-in code interpreter that Azure Container Apps dynamic sessions provide, you can also use custom containers to define your own session sandboxes.
19
19
20
+
> [!NOTE]
21
+
> This article applies only to custom container session pools. Unless noted, features described here aren't available for code interpreter session pools.
22
+
20
23
## Uses for custom container sessions
21
24
22
25
Custom containers allow you to build solutions tailored to your needs. They enable you to execute code or run applications in environments that are fast and ephemeral and offer secure, sandboxed spaces with Hyper-V. Additionally, they can be configured with optional network isolation. Some examples include:
@@ -31,6 +34,123 @@ To use custom container sessions, you first create a session pool with a custom
31
34
32
35
When your application requests a session, an instance is instantly allocated from the pool. The session remains active until it enters an idle state, which is then automatically stopped and destroyed.
33
36
37
+
## Container probes for session pools
38
+
39
+
Use container probes to configure health checks for custom container session pools and maintain healthy session instances.
40
+
41
+
> [!NOTE]
42
+
> Container probes require API version `2025-02-02-preview` or later.
43
+
44
+
Container probes let you define health checks for session containers, similar to health probes in Azure Container Apps. When configured, the session pool monitors each session instance and removes unhealthy instances.
45
+
46
+
The session pool:
47
+
48
+
- Ensures ready session instances are healthy based on the probes.
- Scales up to maintain the configured `readySessionInstances` count with healthy sessions.
51
+
52
+
Session pools support **Liveness** and **Startup** probe types. For more information about how probes work, see [Health probes in Azure Container Apps](health-probes.md?tabs=arm-template).
53
+
54
+
### Configuration
55
+
56
+
When you create or update a session pool, specify probes in the `properties.customContainerTemplate.containers` section of your request payload.
57
+
58
+
For the full API specification, see [SessionPools API](/rest/api/resource-manager/containerapps/container-apps-session-pools/create-or-update?view=rest-resource-manager-containerapps-2025-07-01&tabs=HTTP).
If your session pool isn't maintaining the expected number of healthy `readySessionInstances`, consider the following:
103
+
104
+
1.**Check container logs** - Review session container logs to identify issues with probe endpoints or container startup. See [View logs for custom container session pools](../code-interpreter/bring-your-own-code-interpreter/tutorials/custom-container-logs.md).
105
+
2.**Verify probe configuration** - Ensure probe paths, ports, and thresholds are configured correctly for your application.
106
+
3.**Review container health** - Check for issues inside your container that prevent probe endpoints from responding successfully.
107
+
108
+
## Stop a session
109
+
110
+
Use the Stop Session API to terminate a session in a custom container session pool.
111
+
112
+
113
+
114
+
Session pools support automatic session management through `lifecycleConfiguration`, which handles session lifecycle based on your configuration. However, there are scenarios where you may need more control.
115
+
116
+
After allocating a session, you can call this API to manually terminate it at any time. This is useful when:
117
+
118
+
- You need to clean up resources before a session reaches its time-to-live.
119
+
- Your session pool has reached its maximum concurrent sessions limit and you need to free up capacity for new sessions.
120
+
- A session has completed its work and you want to release resources immediately.
121
+
122
+
### API reference
123
+
124
+
#### Request
125
+
126
+
```http
127
+
POST {PoolManagementEndpoint}/.management/stopSession?api-version=2025-02-02-preview&identifier={SessionIdentifier}
128
+
```
129
+
130
+
#### Parameters
131
+
132
+
| Parameter | Type | Required | Description |
133
+
| --- | --- | --- | --- |
134
+
|`api-version`| string | Yes | The API version to use (for example, `2025-02-02-preview`). |
135
+
|`identifier`| string | Yes | The unique identifier of the session to stop. |
136
+
137
+
### Examples
138
+
139
+
#### Request
140
+
141
+
```http
142
+
POST https://{PoolManagementEndpoint}/.management/stopSession?api-version=2025-02-02-preview&identifier=testSessionIdentifier
143
+
```
144
+
145
+
#### Response
146
+
147
+
```text
148
+
HTTP/1.1 200 OK
149
+
Content-Type: text/plain
150
+
151
+
Session testSessionIdentifier in session pool testSessionPool stopped.
152
+
```
153
+
34
154
## Logging
35
155
36
156
Custom container session pools integrate with Azure Monitor and Log Analytics. Application logs are captured only if your container writes output to `stdout` or `stderr`, so make sure your app emits logs to the console.
0 commit comments