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-custom-container.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,11 +18,11 @@ In addition to the built-in code interpreter that Azure Container Apps dynamic s
18
18
19
19
## Uses for custom container sessions
20
20
21
-
Custom containers allow you to build solutions tailored to your needs. They enable you to execute code or 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:
21
+
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:
22
22
23
23
***Code interpreters**: When you need to execute untrusted code in secure sandboxes by a language not supported in the built-in interpreter, or you need full control over the code interpreter environment.
24
24
25
-
***Isolated execution**: When you need to run applications in hostile, multitenant scenarios where each tenant or user has their own sandboxed environment. These environments are isolated from each other and from the host application. Some examples include applications that run user-provided code, code that grants end user access to a cloud-based shell, and development environments.
25
+
***Isolated execution**: When you need to run applications in hostile, multitenant scenarios where each tenant or user has their own sandboxed environment. These environments are isolated from each other and from the host application. Some examples include applications that run user-provided code, code that grants end user access to a cloud-based shell, AI agents, and development environments.
26
26
27
27
## Using custom container sessions
28
28
@@ -34,7 +34,7 @@ When your application requests a session, an instance is instantly allocated fro
34
34
35
35
To create a custom container session pool, you need to provide a container image and pool configuration settings.
36
36
37
-
You communicate with each session using HTTP requests. The custom container must expose an HTTP server on a port that you specify to respond to these requests.
37
+
You invoke or communicate with each session using HTTP requests. The custom container must expose an HTTP server on a port that you specify to respond to these requests.
38
38
39
39
# [Azure CLI](#tab/azure-cli)
40
40
@@ -184,7 +184,6 @@ Your application interacts with a session using the session pool's management AP
184
184
A pool management endpoint for custom container sessions follows this format: `https://<SESSION_POOL>.<ENVIRONMENT_ID>.<REGION>.azurecontainerapps.io`.
185
185
186
186
To retrieve the session pool's management endpoint, use the `az containerapp sessionpool show` command:
187
-
188
187
```bash
189
188
az containerapp sessionpool show \
190
189
--name <SESSION_POOL_NAME> \
@@ -195,24 +194,39 @@ az containerapp sessionpool show \
195
194
196
195
All requests to the pool management endpoint must include an `Authorization` header with a bearer token. To learn how to authenticate with the pool management API, see [Authentication](sessions.md#authentication).
197
196
198
-
Every request to the API requires query string parameter of `identifier` with value of the session ID. The session ID is a unique identifier for the session that allows you to interact with specific sessions. To learn more about session identifiers, see [Session identifiers](sessions.md#session-identifiers).
197
+
Each API request must also include the query string parameter `identifier` with the session ID. This unique session ID enables your application to interact with specific sessions. To learn more about session identifiers, see [Session identifiers](sessions.md#session-identifiers).
198
+
199
+
> [!IMPORTANT]
200
+
> The session identifier is sensitive information which requires a secure process as you create and manage its value. To protect this value, your application must ensure each user or tenant only has access to their own sessions.
201
+
> Failure to secure access to sessions may result in misuse or unauthorized access to data stored in your users' sessions. For more information, see [Session identifiers](sessions.md#session-identifiers)
202
+
203
+
#### Forwarding Requests to the Session's Container:
204
+
205
+
Anything in the path following the base pool management endpoint is forwarded to the session's container.
206
+
207
+
For example, if you make a call to `<POOL_MANAGEMENT_ENDPOINT>/api/uploadfile`, the request is routed to the session's container at `0.0.0.0:<TARGET_PORT>/api/uploadfile`.
208
+
209
+
#### Continuous Session Interaction:
210
+
211
+
You can continue making requests to the same session. If there are no requests to the session for longer than the cooldown period, the session is automatically deleted.
212
+
213
+
#### Sample Request
199
214
200
215
The following example shows a request to a custom container session by a user ID.
201
216
202
217
Before you send the request, replace the placeholders between the `<>` brackets with values specific to your request.
203
218
204
219
```http
205
-
POST https://<SESSION_POOL_NAME>.<ENVIRONMENT_ID>.<REGION>.azurecontainerapps.io/api/execute-command?identifier=<USER_ID>
220
+
POST https://<SESSION_POOL_NAME>.<ENVIRONMENT_ID>.<REGION>.azurecontainerapps.io/<API_PATH_EXPOSED_BY_CONTAINER>?identifier=<USER_ID>
206
221
Authorization: Bearer <TOKEN>
207
-
208
222
{
209
223
"command": "echo 'Hello, world!'"
210
224
}
211
225
```
212
226
213
227
This request is forwarded to the custom container session with the identifier for the user's ID. If the session isn't already running, Azure Container Apps allocates a session from the pool before forwarding the request.
214
228
215
-
In the example, the session's container receives the request at `http://0.0.0.0:<INGRESS_PORT>/api/execute-command`.
229
+
In the example, the session's container receives the request at `http://0.0.0.0:<INGRESS_PORT>/<API_PATH_EXPOSED_BY_CONTAINER>`.
0 commit comments