Skip to content

Commit f3a0135

Browse files
Merge pull request #278632 from sanchitmehta/sanmeht/update-custom-containers
Add more details about custom container-based sessions
2 parents 4ec24e4 + 9aef01a commit f3a0135

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

articles/container-apps/sessions-custom-container.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ In addition to the built-in code interpreter that Azure Container Apps dynamic s
1818
1919
## Uses for custom container sessions
2020

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:
2222

2323
* **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.
2424

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.
2626

2727
## Using custom container sessions
2828

@@ -34,7 +34,7 @@ When your application requests a session, an instance is instantly allocated fro
3434

3535
To create a custom container session pool, you need to provide a container image and pool configuration settings.
3636

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.
3838

3939
# [Azure CLI](#tab/azure-cli)
4040

@@ -184,7 +184,6 @@ Your application interacts with a session using the session pool's management AP
184184
A pool management endpoint for custom container sessions follows this format: `https://<SESSION_POOL>.<ENVIRONMENT_ID>.<REGION>.azurecontainerapps.io`.
185185

186186
To retrieve the session pool's management endpoint, use the `az containerapp sessionpool show` command:
187-
188187
```bash
189188
az containerapp sessionpool show \
190189
--name <SESSION_POOL_NAME> \
@@ -195,24 +194,39 @@ az containerapp sessionpool show \
195194

196195
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).
197196

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
199214

200215
The following example shows a request to a custom container session by a user ID.
201216

202217
Before you send the request, replace the placeholders between the `<>` brackets with values specific to your request.
203218

204219
```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>
206221
Authorization: Bearer <TOKEN>
207-
208222
{
209223
"command": "echo 'Hello, world!'"
210224
}
211225
```
212226

213227
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.
214228

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>`.
216230

217231
## Next steps
218232

0 commit comments

Comments
 (0)