指定されたプロパティを使用してセッション プールを作成または更新します。
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}?api-version=2026-07-01
URI パラメーター
| 名前 |
/ |
必須 |
型 |
説明 |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
リソース グループの名前。 名前は大文字と小文字を区別しません。
|
|
sessionPoolName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-z][a-z0-9]*$
|
セッション・プールの名前。
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
ターゲット サブスクリプションの ID。 値は UUID である必要があります。
|
|
api-version
|
query |
True
|
string
minLength: 1
|
この操作に使用する API バージョン。
|
要求本文
応答
| 名前 |
型 |
説明 |
|
200 OK
|
SessionPool
|
リソース「SessionPool」更新操作が成功しました
|
|
201 Created
|
SessionPool
|
リソース「SessionPool」作成操作が成功しました
ヘッダー
- Azure-AsyncOperation: string
- Retry-After: integer
|
|
Other Status Codes
|
ErrorResponse
|
予期しないエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー。
型:
oauth2
フロー:
implicit
Authorization URL (承認 URL):
https://login.microsoftonline.com/common/oauth2/authorize
スコープ
| 名前 |
説明 |
|
user_impersonation
|
あなたのユーザー アカウントになりすます
|
例
Create or Update Session Pool with lifecycle OnContainerExit Timed
要求のサンプル
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool?api-version=2026-07-01
{
"identity": {
"type": "SystemAssigned"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
],
"poolManagementType": "Dynamic",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
import com.azure.resourcemanager.appcontainers.models.ContainerType;
import com.azure.resourcemanager.appcontainers.models.CustomContainerTemplate;
import com.azure.resourcemanager.appcontainers.models.DynamicPoolConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleType;
import com.azure.resourcemanager.appcontainers.models.ManagedIdentitySetting;
import com.azure.resourcemanager.appcontainers.models.ManagedServiceIdentity;
import com.azure.resourcemanager.appcontainers.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.appcontainers.models.PoolManagementType;
import com.azure.resourcemanager.appcontainers.models.ScaleConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionContainer;
import com.azure.resourcemanager.appcontainers.models.SessionContainerResources;
import com.azure.resourcemanager.appcontainers.models.SessionIngress;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkStatus;
import com.azure.resourcemanager.appcontainers.models.SessionPoolIdentityLifeCycle;
import com.azure.resourcemanager.appcontainers.models.SessionRegistryCredentials;
import java.util.Arrays;
/**
* Samples for ContainerAppsSessionPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json
*/
/**
* Sample code: Create or Update Session Pool with lifecycle OnContainerExit Timed.
*
* @param manager Entry point to ContainerAppsApiManager.
*/
public static void createOrUpdateSessionPoolWithLifecycleOnContainerExitTimed(
com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
manager.containerAppsSessionPools().define("testsessionpool").withRegion("East US")
.withExistingResourceGroup("rg")
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED))
.withEnvironmentId(
"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.withContainerType(ContainerType.CUSTOM_CONTAINER).withPoolManagementType(PoolManagementType.DYNAMIC)
.withScaleConfiguration(
new ScaleConfiguration().withMaxConcurrentSessions(500).withReadySessionInstances(100))
.withDynamicPoolConfiguration(
new DynamicPoolConfiguration().withLifecycleConfiguration(new LifecycleConfiguration()
.withLifecycleType(LifecycleType.ON_CONTAINER_EXIT).withMaxAlivePeriodInSeconds(86400)))
.withCustomContainerTemplate(new CustomContainerTemplate()
.withRegistryCredentials(new SessionRegistryCredentials().withServer("test.azurecr.io").withIdentity(
"/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"))
.withContainers(Arrays.asList(new SessionContainer().withImage("repo/testcontainer:v4")
.withName("testinitcontainer").withCommand(Arrays.asList("/bin/sh"))
.withArgs(Arrays.asList("-c", "while true; do echo hello; sleep 10;done"))
.withResources(new SessionContainerResources().withCpu(0.25D).withMemory("0.5Gi"))))
.withIngress(new SessionIngress().withTargetPort(80)))
.withSessionNetworkConfiguration(
new SessionNetworkConfiguration().withStatus(SessionNetworkStatus.EGRESS_ENABLED))
.withManagedIdentitySettings(Arrays.asList(
new ManagedIdentitySetting().withIdentity("system").withLifecycle(SessionPoolIdentityLifeCycle.MAIN)))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.appcontainers import ContainerAppsAPIClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-appcontainers
# USAGE
python session_pools_lifecycle_on_container_exit_create_or_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerAppsAPIClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.container_apps_session_pools.begin_create_or_update(
resource_group_name="rg",
session_pool_name="testsessionpool",
session_pool_envelope={
"identity": {"type": "SystemAssigned"},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"args": ["-c", "while true; do echo hello; sleep 10;done"],
"command": ["/bin/sh"],
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {"cpu": 0.25, "memory": "0.5Gi"},
}
],
"ingress": {"targetPort": 80},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io",
},
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {"lifecycleType": "OnContainerExit", "maxAlivePeriodInSeconds": 86400}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [{"identity": "system", "lifecycle": "Main"}],
"poolManagementType": "Dynamic",
"scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100},
"sessionNetworkConfiguration": {"status": "EgressEnabled"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armappcontainers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v5"
)
// Generated from example definition: 2026-07-01/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json
func ExampleContainerAppsSessionPoolsClient_BeginCreateOrUpdate_createOrUpdateSessionPoolWithLifecycleOnContainerExitTimed() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappcontainers.NewClientFactory("34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerAppsSessionPoolsClient().BeginCreateOrUpdate(ctx, "rg", "testsessionpool", armappcontainers.SessionPool{
Identity: &armappcontainers.ManagedServiceIdentity{
Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
},
Location: to.Ptr("East US"),
Properties: &armappcontainers.SessionPoolProperties{
ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer),
CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{
Containers: []*armappcontainers.SessionContainer{
{
Name: to.Ptr("testinitcontainer"),
Args: []*string{
to.Ptr("-c"),
to.Ptr("while true; do echo hello; sleep 10;done"),
},
Command: []*string{
to.Ptr("/bin/sh"),
},
Image: to.Ptr("repo/testcontainer:v4"),
Resources: &armappcontainers.SessionContainerResources{
CPU: to.Ptr[float64](0.25),
Memory: to.Ptr("0.5Gi"),
},
},
},
Ingress: &armappcontainers.SessionIngress{
TargetPort: to.Ptr[int32](80),
},
RegistryCredentials: &armappcontainers.SessionRegistryCredentials{
Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"),
Server: to.Ptr("test.azurecr.io"),
},
},
DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
LifecycleType: to.Ptr(armappcontainers.LifecycleTypeOnContainerExit),
MaxAlivePeriodInSeconds: to.Ptr[int32](86400),
},
},
EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
ManagedIdentitySettings: []*armappcontainers.ManagedIdentitySetting{
{
Identity: to.Ptr("system"),
Lifecycle: to.Ptr(armappcontainers.SessionPoolIdentityLifeCycleMain),
},
},
PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
ScaleConfiguration: &armappcontainers.ScaleConfiguration{
MaxConcurrentSessions: to.Ptr[int32](500),
ReadySessionInstances: to.Ptr[int32](100),
},
SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse{
// SessionPool: armappcontainers.SessionPool{
// Name: to.Ptr("testsessionpool"),
// Type: to.Ptr("Microsoft.App/sessionPools"),
// ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"),
// Identity: &armappcontainers.ManagedServiceIdentity{
// Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("bce8c037-3d10-44a4-a970-25f799611fc6"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// Location: to.Ptr("East US"),
// Properties: &armappcontainers.SessionPoolProperties{
// ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer),
// CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{
// Containers: []*armappcontainers.SessionContainer{
// {
// Name: to.Ptr("testinitcontainer"),
// Args: []*string{
// to.Ptr("-c"),
// to.Ptr("while true; do echo hello; sleep 10;done"),
// },
// Command: []*string{
// to.Ptr("/bin/sh"),
// },
// Image: to.Ptr("repo/testcontainer:v4"),
// Resources: &armappcontainers.SessionContainerResources{
// CPU: to.Ptr[float64](0.25),
// Memory: to.Ptr("0.5Gi"),
// },
// },
// },
// Ingress: &armappcontainers.SessionIngress{
// TargetPort: to.Ptr[int32](80),
// },
// RegistryCredentials: &armappcontainers.SessionRegistryCredentials{
// Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"),
// Server: to.Ptr("test.azurecr.io"),
// },
// },
// DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
// LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
// LifecycleType: to.Ptr(armappcontainers.LifecycleTypeOnContainerExit),
// MaxAlivePeriodInSeconds: to.Ptr[int32](86400),
// },
// },
// EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
// NodeCount: to.Ptr[int32](1),
// PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"),
// PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
// ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded),
// ScaleConfiguration: &armappcontainers.ScaleConfiguration{
// MaxConcurrentSessions: to.Ptr[int32](500),
// ReadySessionInstances: to.Ptr[int32](100),
// },
// SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
// Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update a session pool with the given properties.
*
* @summary create or update a session pool with the given properties.
* x-ms-original-file: 2026-07-01/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json
*/
async function createOrUpdateSessionPoolWithLifecycleOnContainerExitTimed() {
const credential = new DefaultAzureCredential();
const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
const client = new ContainerAppsAPIClient(credential, subscriptionId);
const result = await client.containerAppsSessionPools.createOrUpdate("rg", "testsessionpool", {
identity: { type: "SystemAssigned" },
location: "East US",
containerType: "CustomContainer",
customContainerTemplate: {
containers: [
{
name: "testinitcontainer",
args: ["-c", "while true; do echo hello; sleep 10;done"],
command: ["/bin/sh"],
image: "repo/testcontainer:v4",
resources: { cpu: 0.25, memory: "0.5Gi" },
},
],
ingress: { targetPort: 80 },
registryCredentials: {
identity:
"/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
server: "test.azurecr.io",
},
},
dynamicPoolConfiguration: {
lifecycleConfiguration: { lifecycleType: "OnContainerExit", maxAlivePeriodInSeconds: 86400 },
},
environmentId:
"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
managedIdentitySettings: [{ identity: "system", lifecycle: "Main" }],
poolManagementType: "Dynamic",
scaleConfiguration: { maxConcurrentSessions: 500, readySessionInstances: 100 },
sessionNetworkConfiguration: { status: "EgressEnabled" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"nodeCount": 1,
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"poolManagementType": "Dynamic",
"provisioningState": "Succeeded",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
],
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"poolManagementType": "Dynamic",
"provisioningState": "InProgress",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
Create or Update Session Pool with lifecycle type Timed
要求のサンプル
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool?api-version=2026-07-01
{
"identity": {
"type": "SystemAssigned"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
],
"poolManagementType": "Dynamic",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
import com.azure.resourcemanager.appcontainers.models.ContainerType;
import com.azure.resourcemanager.appcontainers.models.CustomContainerTemplate;
import com.azure.resourcemanager.appcontainers.models.DynamicPoolConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleType;
import com.azure.resourcemanager.appcontainers.models.ManagedIdentitySetting;
import com.azure.resourcemanager.appcontainers.models.ManagedServiceIdentity;
import com.azure.resourcemanager.appcontainers.models.ManagedServiceIdentityType;
import com.azure.resourcemanager.appcontainers.models.PoolManagementType;
import com.azure.resourcemanager.appcontainers.models.ScaleConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionContainer;
import com.azure.resourcemanager.appcontainers.models.SessionContainerResources;
import com.azure.resourcemanager.appcontainers.models.SessionIngress;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkStatus;
import com.azure.resourcemanager.appcontainers.models.SessionPoolIdentityLifeCycle;
import com.azure.resourcemanager.appcontainers.models.SessionRegistryCredentials;
import java.util.Arrays;
/**
* Samples for ContainerAppsSessionPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/SessionPools_LifecycleTimed_CreateOrUpdate.json
*/
/**
* Sample code: Create or Update Session Pool with lifecycle type Timed.
*
* @param manager Entry point to ContainerAppsApiManager.
*/
public static void createOrUpdateSessionPoolWithLifecycleTypeTimed(
com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
manager.containerAppsSessionPools().define("testsessionpool").withRegion("East US")
.withExistingResourceGroup("rg")
.withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED))
.withEnvironmentId(
"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube")
.withContainerType(ContainerType.CUSTOM_CONTAINER).withPoolManagementType(PoolManagementType.DYNAMIC)
.withScaleConfiguration(
new ScaleConfiguration().withMaxConcurrentSessions(500).withReadySessionInstances(100))
.withDynamicPoolConfiguration(new DynamicPoolConfiguration().withLifecycleConfiguration(
new LifecycleConfiguration().withLifecycleType(LifecycleType.TIMED).withCooldownPeriodInSeconds(600)))
.withCustomContainerTemplate(new CustomContainerTemplate()
.withRegistryCredentials(new SessionRegistryCredentials().withServer("test.azurecr.io").withIdentity(
"/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"))
.withContainers(Arrays.asList(new SessionContainer().withImage("repo/testcontainer:v4")
.withName("testinitcontainer").withCommand(Arrays.asList("/bin/sh"))
.withArgs(Arrays.asList("-c", "while true; do echo hello; sleep 10;done"))
.withResources(new SessionContainerResources().withCpu(0.25D).withMemory("0.5Gi"))))
.withIngress(new SessionIngress().withTargetPort(80)))
.withSessionNetworkConfiguration(
new SessionNetworkConfiguration().withStatus(SessionNetworkStatus.EGRESS_ENABLED))
.withManagedIdentitySettings(Arrays.asList(
new ManagedIdentitySetting().withIdentity("system").withLifecycle(SessionPoolIdentityLifeCycle.MAIN)))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.appcontainers import ContainerAppsAPIClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-appcontainers
# USAGE
python session_pools_lifecycle_timed_create_or_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerAppsAPIClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.container_apps_session_pools.begin_create_or_update(
resource_group_name="rg",
session_pool_name="testsessionpool",
session_pool_envelope={
"identity": {"type": "SystemAssigned"},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"args": ["-c", "while true; do echo hello; sleep 10;done"],
"command": ["/bin/sh"],
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {"cpu": 0.25, "memory": "0.5Gi"},
}
],
"ingress": {"targetPort": 80},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io",
},
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {"cooldownPeriodInSeconds": 600, "lifecycleType": "Timed"}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [{"identity": "system", "lifecycle": "Main"}],
"poolManagementType": "Dynamic",
"scaleConfiguration": {"maxConcurrentSessions": 500, "readySessionInstances": 100},
"sessionNetworkConfiguration": {"status": "EgressEnabled"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/SessionPools_LifecycleTimed_CreateOrUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armappcontainers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v5"
)
// Generated from example definition: 2026-07-01/SessionPools_LifecycleTimed_CreateOrUpdate.json
func ExampleContainerAppsSessionPoolsClient_BeginCreateOrUpdate_createOrUpdateSessionPoolWithLifecycleTypeTimed() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappcontainers.NewClientFactory("34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerAppsSessionPoolsClient().BeginCreateOrUpdate(ctx, "rg", "testsessionpool", armappcontainers.SessionPool{
Identity: &armappcontainers.ManagedServiceIdentity{
Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
},
Location: to.Ptr("East US"),
Properties: &armappcontainers.SessionPoolProperties{
ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer),
CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{
Containers: []*armappcontainers.SessionContainer{
{
Name: to.Ptr("testinitcontainer"),
Args: []*string{
to.Ptr("-c"),
to.Ptr("while true; do echo hello; sleep 10;done"),
},
Command: []*string{
to.Ptr("/bin/sh"),
},
Image: to.Ptr("repo/testcontainer:v4"),
Resources: &armappcontainers.SessionContainerResources{
CPU: to.Ptr[float64](0.25),
Memory: to.Ptr("0.5Gi"),
},
},
},
Ingress: &armappcontainers.SessionIngress{
TargetPort: to.Ptr[int32](80),
},
RegistryCredentials: &armappcontainers.SessionRegistryCredentials{
Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"),
Server: to.Ptr("test.azurecr.io"),
},
},
DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
CooldownPeriodInSeconds: to.Ptr[int32](600),
LifecycleType: to.Ptr(armappcontainers.LifecycleTypeTimed),
},
},
EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
ManagedIdentitySettings: []*armappcontainers.ManagedIdentitySetting{
{
Identity: to.Ptr("system"),
Lifecycle: to.Ptr(armappcontainers.SessionPoolIdentityLifeCycleMain),
},
},
PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
ScaleConfiguration: &armappcontainers.ScaleConfiguration{
MaxConcurrentSessions: to.Ptr[int32](500),
ReadySessionInstances: to.Ptr[int32](100),
},
SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse{
// SessionPool: armappcontainers.SessionPool{
// Name: to.Ptr("testsessionpool"),
// Type: to.Ptr("Microsoft.App/sessionPools"),
// ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"),
// Identity: &armappcontainers.ManagedServiceIdentity{
// Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("bce8c037-3d10-44a4-a970-25f799611fc6"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// Location: to.Ptr("East US"),
// Properties: &armappcontainers.SessionPoolProperties{
// ContainerType: to.Ptr(armappcontainers.ContainerTypeCustomContainer),
// CustomContainerTemplate: &armappcontainers.CustomContainerTemplate{
// Containers: []*armappcontainers.SessionContainer{
// {
// Name: to.Ptr("testinitcontainer"),
// Args: []*string{
// to.Ptr("-c"),
// to.Ptr("while true; do echo hello; sleep 10;done"),
// },
// Command: []*string{
// to.Ptr("/bin/sh"),
// },
// Image: to.Ptr("repo/testcontainer:v4"),
// Resources: &armappcontainers.SessionContainerResources{
// CPU: to.Ptr[float64](0.25),
// Memory: to.Ptr("0.5Gi"),
// },
// },
// },
// Ingress: &armappcontainers.SessionIngress{
// TargetPort: to.Ptr[int32](80),
// },
// RegistryCredentials: &armappcontainers.SessionRegistryCredentials{
// Identity: to.Ptr("/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"),
// Server: to.Ptr("test.azurecr.io"),
// },
// },
// DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
// LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
// CooldownPeriodInSeconds: to.Ptr[int32](600),
// LifecycleType: to.Ptr(armappcontainers.LifecycleTypeTimed),
// },
// },
// EnvironmentID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
// NodeCount: to.Ptr[int32](1),
// PoolManagementEndpoint: to.Ptr("https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"),
// PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
// ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded),
// ScaleConfiguration: &armappcontainers.ScaleConfiguration{
// MaxConcurrentSessions: to.Ptr[int32](500),
// ReadySessionInstances: to.Ptr[int32](100),
// },
// SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
// Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update a session pool with the given properties.
*
* @summary create or update a session pool with the given properties.
* x-ms-original-file: 2026-07-01/SessionPools_LifecycleTimed_CreateOrUpdate.json
*/
async function createOrUpdateSessionPoolWithLifecycleTypeTimed() {
const credential = new DefaultAzureCredential();
const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
const client = new ContainerAppsAPIClient(credential, subscriptionId);
const result = await client.containerAppsSessionPools.createOrUpdate("rg", "testsessionpool", {
identity: { type: "SystemAssigned" },
location: "East US",
containerType: "CustomContainer",
customContainerTemplate: {
containers: [
{
name: "testinitcontainer",
args: ["-c", "while true; do echo hello; sleep 10;done"],
command: ["/bin/sh"],
image: "repo/testcontainer:v4",
resources: { cpu: 0.25, memory: "0.5Gi" },
},
],
ingress: { targetPort: 80 },
registryCredentials: {
identity:
"/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
server: "test.azurecr.io",
},
},
dynamicPoolConfiguration: {
lifecycleConfiguration: { cooldownPeriodInSeconds: 600, lifecycleType: "Timed" },
},
environmentId:
"/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
managedIdentitySettings: [{ identity: "system", lifecycle: "Main" }],
poolManagementType: "Dynamic",
scaleConfiguration: { maxConcurrentSessions: 500, readySessionInstances: 100 },
sessionNetworkConfiguration: { status: "EgressEnabled" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"nodeCount": 1,
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"poolManagementType": "Dynamic",
"provisioningState": "Succeeded",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
},
"location": "East US",
"properties": {
"containerType": "CustomContainer",
"customContainerTemplate": {
"containers": [
{
"name": "testinitcontainer",
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
],
"command": [
"/bin/sh"
],
"image": "repo/testcontainer:v4",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
}
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
"server": "test.azurecr.io"
}
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
],
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"poolManagementType": "Dynamic",
"provisioningState": "InProgress",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
Create or Update Session Pool with MCP server
要求のサンプル
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool?api-version=2026-07-01
{
"location": "East US",
"properties": {
"containerType": "Shell",
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"poolManagementType": "Dynamic",
"scaleConfiguration": {
"maxConcurrentSessions": 50
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
import com.azure.resourcemanager.appcontainers.models.ContainerType;
import com.azure.resourcemanager.appcontainers.models.DynamicPoolConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleConfiguration;
import com.azure.resourcemanager.appcontainers.models.LifecycleType;
import com.azure.resourcemanager.appcontainers.models.PoolManagementType;
import com.azure.resourcemanager.appcontainers.models.ScaleConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkConfiguration;
import com.azure.resourcemanager.appcontainers.models.SessionNetworkStatus;
/**
* Samples for ContainerAppsSessionPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: 2026-07-01/SessionPools_McpServer_CreateOrUpdate.json
*/
/**
* Sample code: Create or Update Session Pool with MCP server.
*
* @param manager Entry point to ContainerAppsApiManager.
*/
public static void createOrUpdateSessionPoolWithMCPServer(
com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
manager.containerAppsSessionPools().define("testsessionpool").withRegion("East US")
.withExistingResourceGroup("rg").withContainerType(ContainerType.fromString("Shell"))
.withPoolManagementType(PoolManagementType.DYNAMIC)
.withScaleConfiguration(new ScaleConfiguration().withMaxConcurrentSessions(50))
.withDynamicPoolConfiguration(new DynamicPoolConfiguration().withLifecycleConfiguration(
new LifecycleConfiguration().withLifecycleType(LifecycleType.TIMED).withCooldownPeriodInSeconds(600)))
.withSessionNetworkConfiguration(
new SessionNetworkConfiguration().withStatus(SessionNetworkStatus.EGRESS_ENABLED))
.create();
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
from azure.identity import DefaultAzureCredential
from azure.mgmt.appcontainers import ContainerAppsAPIClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-appcontainers
# USAGE
python session_pools_mcp_server_create_or_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ContainerAppsAPIClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.container_apps_session_pools.begin_create_or_update(
resource_group_name="rg",
session_pool_name="testsessionpool",
session_pool_envelope={
"location": "East US",
"properties": {
"containerType": "Shell",
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {"cooldownPeriodInSeconds": 600, "lifecycleType": "Timed"}
},
"poolManagementType": "Dynamic",
"scaleConfiguration": {"maxConcurrentSessions": 50},
"sessionNetworkConfiguration": {"status": "EgressEnabled"},
},
},
).result()
print(response)
# x-ms-original-file: 2026-07-01/SessionPools_McpServer_CreateOrUpdate.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armappcontainers_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcontainers/armappcontainers/v5"
)
// Generated from example definition: 2026-07-01/SessionPools_McpServer_CreateOrUpdate.json
func ExampleContainerAppsSessionPoolsClient_BeginCreateOrUpdate_createOrUpdateSessionPoolWithMcpServer() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armappcontainers.NewClientFactory("34adfa4f-cedf-4dc0-ba29-b6d1a69ab345", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
poller, err := clientFactory.NewContainerAppsSessionPoolsClient().BeginCreateOrUpdate(ctx, "rg", "testsessionpool", armappcontainers.SessionPool{
Location: to.Ptr("East US"),
Properties: &armappcontainers.SessionPoolProperties{
ContainerType: to.Ptr(armappcontainers.ContainerType("Shell")),
DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
CooldownPeriodInSeconds: to.Ptr[int32](600),
LifecycleType: to.Ptr(armappcontainers.LifecycleTypeTimed),
},
},
PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
ScaleConfiguration: &armappcontainers.ScaleConfiguration{
MaxConcurrentSessions: to.Ptr[int32](50),
},
SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
},
},
}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
res, err := poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to poll the result: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res = armappcontainers.ContainerAppsSessionPoolsClientCreateOrUpdateResponse{
// SessionPool: armappcontainers.SessionPool{
// Name: to.Ptr("testsessionpool"),
// Type: to.Ptr("Microsoft.App/sessionPools"),
// ID: to.Ptr("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool"),
// Location: to.Ptr("East US"),
// Properties: &armappcontainers.SessionPoolProperties{
// ContainerType: to.Ptr(armappcontainers.ContainerType("Shell")),
// DynamicPoolConfiguration: &armappcontainers.DynamicPoolConfiguration{
// LifecycleConfiguration: &armappcontainers.LifecycleConfiguration{
// CooldownPeriodInSeconds: to.Ptr[int32](600),
// LifecycleType: to.Ptr(armappcontainers.LifecycleTypeTimed),
// },
// },
// PoolManagementEndpoint: to.Ptr("https://eastus.dynamicsessions.io/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/sessionPools/testsessionpool"),
// PoolManagementType: to.Ptr(armappcontainers.PoolManagementTypeDynamic),
// ProvisioningState: to.Ptr(armappcontainers.SessionPoolProvisioningStateSucceeded),
// ScaleConfiguration: &armappcontainers.ScaleConfiguration{
// MaxConcurrentSessions: to.Ptr[int32](50),
// },
// SessionNetworkConfiguration: &armappcontainers.SessionNetworkConfiguration{
// Status: to.Ptr(armappcontainers.SessionNetworkStatusEgressEnabled),
// },
// },
// },
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { ContainerAppsAPIClient } = require("@azure/arm-appcontainers");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to create or update a session pool with the given properties.
*
* @summary create or update a session pool with the given properties.
* x-ms-original-file: 2026-07-01/SessionPools_McpServer_CreateOrUpdate.json
*/
async function createOrUpdateSessionPoolWithMCPServer() {
const credential = new DefaultAzureCredential();
const subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
const client = new ContainerAppsAPIClient(credential, subscriptionId);
const result = await client.containerAppsSessionPools.createOrUpdate("rg", "testsessionpool", {
location: "East US",
containerType: "Shell",
dynamicPoolConfiguration: {
lifecycleConfiguration: { cooldownPeriodInSeconds: 600, lifecycleType: "Timed" },
},
poolManagementType: "Dynamic",
scaleConfiguration: { maxConcurrentSessions: 50 },
sessionNetworkConfiguration: { status: "EgressEnabled" },
});
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
応答のサンプル
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"location": "East US",
"properties": {
"containerType": "Shell",
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"poolManagementEndpoint": "https://eastus.dynamicsessions.io/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/sessionPools/testsessionpool",
"poolManagementType": "Dynamic",
"provisioningState": "Succeeded",
"scaleConfiguration": {
"maxConcurrentSessions": 50
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
{
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"location": "East US",
"properties": {
"containerType": "Shell",
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"cooldownPeriodInSeconds": 600,
"lifecycleType": "Timed"
}
},
"poolManagementEndpoint": "https://eastus.dynamicsessions.io/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/sessionPools/testsessionpool",
"poolManagementType": "Dynamic",
"provisioningState": "InProgress",
"scaleConfiguration": {
"maxConcurrentSessions": 50
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
}
}
}
定義
ContainerType
列挙
セッションのコンテナーの種類。 セッションプールを構築するために独自のコンテナを使うこともできますし、特定の言語でワークロードを実行するためにあらかじめ定義されたコンテナを使うこともできます。
| 値 |
説明 |
|
CustomContainer
|
CustomContainer
|
|
PythonLTS
|
PythonLTS
|
createdByType
列挙
リソースを作成した ID の種類。
| 値 |
説明 |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CustomContainerTemplate
Object
カスタム コンテナーの構成。
DynamicPoolConfiguration
Object
動的プールの構成。
EnvironmentVar
Object
Container App コンテナー環境変数。
| 名前 |
型 |
説明 |
|
name
|
string
|
環境変数の名前。
|
|
secretRef
|
string
|
環境変数の値をプルするコンテナー アプリ シークレットの名前。
|
|
value
|
string
|
シークレット以外の環境変数の値。
|
ErrorAdditionalInfo
Object
リソース管理エラーの追加情報
| 名前 |
型 |
説明 |
|
info
|
object
|
追加情報。
|
|
type
|
string
|
追加情報の種類。
|
ErrorDetail
Object
エラーの詳細。
| 名前 |
型 |
説明 |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
エラーに関する追加情報。
|
|
code
|
string
|
エラー コード。
|
|
details
|
ErrorDetail[]
|
エラーの詳細。
|
|
message
|
string
|
エラー メッセージ。
|
|
target
|
string
|
エラーの対象。
|
ErrorResponse
Object
エラー応答
LifecycleConfiguration
Object
動的セッション プール内のセッションのライフサイクル構成プロパティ
| 名前 |
型 |
説明 |
|
cooldownPeriodInSeconds
|
integer
(int32)
|
ライフサイクルの種類が "Timed" の場合のセッションのクールダウン期間 (秒単位)。
|
|
lifecycleType
|
LifecycleType
|
セッション プールのライフサイクルの種類。
|
|
maxAlivePeriodInSeconds
|
integer
(int32)
|
ライフサイクルの種類が "OnContainerExit" の場合のセッションの最大有効期間 (秒単位)。
|
LifecycleType
列挙
セッション プールのライフサイクルの種類。
| 値 |
説明 |
|
Timed
|
タイム
|
|
OnContainerExit
|
OnContainerExit
|
ManagedIdentitySetting
Object
セッション プールに割り当てられているマネージド ID のオプション設定。
| 名前 |
型 |
規定値 |
説明 |
|
identity
|
string
|
|
セッション プールに割り当てられているユーザー割り当てマネージド ID のリソース ID。システム割り当て ID の場合は "system" です。
|
|
lifecycle
|
SessionPoolIdentityLifeCycle
|
None
|
マネージド ID を使用できるセッション プールのライフサイクル ステージを選択するために使用します。
|
ManagedServiceIdentity
Object
マネージド サービス ID (システム割り当て ID またはユーザー割り当て ID)
| 名前 |
型 |
説明 |
|
principalId
|
string
(uuid)
|
システム割り当て ID のサービス プリンシパル ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
|
tenantId
|
string
(uuid)
|
システム割り当て ID のテナント ID。 このプロパティは、システム割り当て ID にのみ提供されます。
|
|
type
|
ManagedServiceIdentityType
|
マネージド サービス ID の種類 (SystemAssigned 型と UserAssigned 型の両方が許可されます)。
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
User-Assigned ID
リソースに関連付けられているユーザー割り当て ID のセット。 userAssignedIdentities ディクショナリ キーは、'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} という形式の ARM リソース ID になります。 ディクショナリ値は、要求内の空のオブジェクト ({}) にすることができます。
|
ManagedServiceIdentityType
列挙
マネージド サービス ID の種類 (SystemAssigned 型と UserAssigned 型の両方が許可されます)。
| 値 |
説明 |
|
None
|
|
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned,UserAssigned
|
|
PoolManagementType
列挙
セッション プールのプール管理の種類。
| 値 |
説明 |
|
Manual
|
Manual
|
|
Dynamic
|
動的
|
ScaleConfiguration
Object
スケール構成。
| 名前 |
型 |
説明 |
|
maxConcurrentSessions
|
integer
(int32)
|
同時に行うセッションの最大数。
|
|
readySessionInstances
|
integer
(int32)
|
準備完了セッション インスタンスの最小数。
|
Scheme
列挙
ホストへの接続に使用するスキーム。 既定値は HTTP です。
| 値 |
説明 |
|
HTTP
|
HTTP
|
|
HTTPS
|
HTTPS
|
SessionContainer
Object
セッション プールのセッションのコンテナー定義。
SessionContainerResources
Object
セッション プールのセッションのコンテナー リソース要件。
| 名前 |
型 |
説明 |
|
cpu
|
number
(double)
|
コアで必要な CPU (例: 0.5)
|
|
memory
|
string
|
必要なメモリ (例: "250Mb" )
|
SessionIngress
Object
セッション プールのイングレス構成。
| 名前 |
型 |
説明 |
|
targetPort
|
integer
(int32)
|
イングレスからのトラフィックのコンテナー内のターゲット ポート
|
SessionNetworkConfiguration
Object
セッション ネットワークの構成。
SessionNetworkStatus
列挙
セッションのネットワーク状態。
| 値 |
説明 |
|
EgressEnabled
|
EgressEnabled
|
|
EgressDisabled
|
EgressDisabled
|
SessionPool
Object
コンテナー アプリ セッション プール。
| 名前 |
型 |
説明 |
|
id
|
string
(arm-id)
|
リソースの完全修飾リソース ID。 例: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
identity
|
ManagedServiceIdentity
|
このリソースに割り当てられているマネージド サービス ID。
|
|
location
|
string
|
リソースが存在する地理的な場所
|
|
name
|
string
|
リソースの名前
|
|
properties.containerType
|
ContainerType
|
セッションのコンテナーの種類。 セッションプールを構築するために独自のコンテナを使うこともできますし、特定の言語でワークロードを実行するためにあらかじめ定義されたコンテナを使うこともできます。
|
|
properties.customContainerTemplate
|
CustomContainerTemplate
|
containerType が CustomContainer の場合のカスタム コンテナー構成。
|
|
properties.dynamicPoolConfiguration
|
DynamicPoolConfiguration
|
poolManagementType が動的な場合のプール構成。
|
|
properties.environmentId
|
string
(arm-id)
|
セッション プールの環境のリソース ID。
|
|
properties.managedIdentitySettings
|
ManagedIdentitySetting[]
|
セッション プールに割り当てられているマネージド ID のオプション設定。
|
|
properties.nodeCount
|
integer
(int32)
|
セッション プールが使用しているノードの数。
|
|
properties.poolManagementEndpoint
|
string
(uri)
|
プールを管理するエンドポイント。
|
|
properties.poolManagementType
|
PoolManagementType
|
セッション プールのプール管理の種類。
|
|
properties.provisioningState
|
SessionPoolProvisioningState
|
セッション プールのプロビジョニング状態。
|
|
properties.scaleConfiguration
|
ScaleConfiguration
|
セッション プールのスケール構成。
|
|
properties.secrets
|
SessionPoolSecret[]
|
セッション プールのシークレット。
|
|
properties.sessionNetworkConfiguration
|
SessionNetworkConfiguration
|
セッション プール内のセッションのネットワーク構成。
|
|
systemData
|
systemData
|
createdBy および modifiedBy 情報を含む Azure Resource Manager メタデータ。
|
|
tags
|
object
|
リソース タグ。
|
|
type
|
string
|
リソースの種類。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"
|
SessionPoolIdentityLifeCycle
列挙
マネージド ID を使用できるセッション プールのライフサイクル ステージを選択するために使用します。
| 値 |
説明 |
|
None
|
いかなるライフサイクル段階でもマネージドIDを使用しないでください。
|
|
Main
|
コンテナアプリのライフサイクルのメインステージではマネージドIDを使用してください。
|
SessionPoolProvisioningState
列挙
セッション プールのプロビジョニング状態。
| 値 |
説明 |
|
InProgress
|
進行中
|
|
Succeeded
|
成功しました
|
|
Failed
|
失敗
|
|
Canceled
|
取り消されました
|
|
Deleting
|
削除中
|
SessionPoolSecret
Object
シークレット定義。
| 名前 |
型 |
説明 |
|
name
|
string
|
シークレット名。
|
|
value
|
string
(password)
|
シークレット値。
|
SessionProbe
Object
セッションプローブの設定。
| 名前 |
型 |
説明 |
|
failureThreshold
|
integer
(int32)
|
成功した後に失敗したと見なされるプローブの連続する最小障害。 既定値は 3 です。 最小値は 1 です。 最大値は 10 です。
|
|
httpGet
|
SessionProbeHttpGet
|
HTTPGet は、実行する http 要求を指定します。
|
|
initialDelaySeconds
|
integer
(int32)
|
コンテナーの起動後、liveness probe が開始するまでの秒数。 最小値は 1 です。 最大値は 60 です。
|
|
periodSeconds
|
integer
(int32)
|
プローブを実行する頻度 (秒単位)。 既定値は 10 秒です。 最小値は 1 です。 最大値は 240 です。
|
|
successThreshold
|
integer
(int32)
|
失敗した後にプローブが成功したと見なされる最小連続成功数。 既定値は 1 です。 ライブ性と起動には 1 にする必要があります。 最小値は 1 です。 最大値は 10 です。
|
|
tcpSocket
|
SessionProbeTcpSocket
|
TCPSocket は、TCP ポートに関連するアクションを指定します。 TCP フックはまだサポートされていません。
|
|
terminationGracePeriodSeconds
|
integer
(int64)
|
プローブの障害時にポッドを正常に終了する必要がある時間 (秒単位)。 猶予期間は、ポッドで実行されているプロセスが終了シグナルを送信してから数秒で、プロセスが強制終了シグナルで強制的に停止される時間です。 この値は、プロセスの予想されるクリーンアップ時間よりも長く設定します。 この値が nil の場合、ポッドの terminationGracePeriodSeconds が使用されます。 それ以外の場合、この値はポッド スペックによって提供される値をオーバーライドします。値は負以外の整数である必要があります。 値 0 は、強制終了信号を介して直ちに停止することを示します (シャットダウンする機会はありません)。 これはアルファ フィールドであり、ProbeTerminationGracePeriod 機能ゲートを有効にする必要があります。 最大値は 3600 秒 (1 時間) です。
|
|
timeoutSeconds
|
integer
(int32)
|
プローブがタイムアウトする秒数。既定値は 1 秒です。 最小値は 1 です。 最大値は 240 です。
|
|
type
|
SessionProbeType
|
プローブのタイプを示します。 Liveness または Startup にすることができ、Readiness プローブはセッションではサポートされていません。 タイプは、プローブのリスト (SessionProbes) のコンテキスト内の各プローブで一意である必要があります。
|
SessionProbeHttpGet
Object
HTTPGet は、実行する http 要求を指定します。
| 名前 |
型 |
説明 |
|
host
|
string
|
接続先のホスト名。既定ではポッド IP が使用されます。 代わりに httpHeaders で "Host" を設定することをお考えでしょう。
|
|
httpHeaders
|
SessionProbeHttpGetHttpHeadersItem[]
|
要求で設定するカスタム ヘッダー。 HTTP では、ヘッダーを繰り返し使用できます。
|
|
path
|
string
|
HTTP サーバー上のアクセスのパス。
|
|
port
|
integer
(int32)
|
コンテナーでアクセスするポートの名前または番号。 数値は 1 ~ 65535 の範囲である必要があります。 名前はIANA_SVC_NAMEである必要があります。
|
|
scheme
|
Scheme
|
ホストへの接続に使用するスキーム。 既定値は HTTP です。
|
Object
HTTPHeader は、HTTP プローブで使用されるカスタム ヘッダーを記述します
| 名前 |
型 |
説明 |
|
name
|
string
|
ヘッダー フィールド名
|
|
value
|
string
|
ヘッダー フィールドの値
|
SessionProbeTcpSocket
Object
TCPSocket は、TCP ポートに関連するアクションを指定します。 TCP フックはまだサポートされていません。
| 名前 |
型 |
説明 |
|
host
|
string
|
省略可能: 接続先のホスト名。既定ではポッド IP が使用されます。
|
|
port
|
integer
(int32)
|
コンテナーでアクセスするポートの番号または名前。 数値は 1 ~ 65535 の範囲である必要があります。 名前はIANA_SVC_NAMEである必要があります。
|
SessionProbeType
列挙
プローブのタイプを示します。 Liveness または Startup にすることができ、Readiness プローブはセッションではサポートされていません。 タイプは、プローブのリスト (SessionProbes) のコンテキスト内の各プローブで一意である必要があります。
| 値 |
説明 |
|
Liveness
|
セッションがまだ進行中で健康かどうかを確認します。
|
|
Startup
|
セッションが正常に開始されているかどうかを確認します。
|
SessionRegistryCredentials
Object
セッション プールのプライベート レジストリ資格情報。
| 名前 |
型 |
説明 |
|
identity
|
string
|
Azure Container Registry での認証に使用するマネージド ID。 ユーザー割り当て ID の場合は、完全なユーザー割り当て ID リソース ID を使用します。 システム割り当て ID の場合は、'system' を使用します
|
|
passwordSecretRef
|
string
|
レジストリ ログイン パスワードを含むシークレットの名前
|
|
server
|
string
|
コンテナー レジストリ サーバー。
|
|
username
|
string
|
コンテナー レジストリのユーザー名。
|
systemData
Object
リソースの作成と最後の変更に関連するメタデータ。
| 名前 |
型 |
説明 |
|
createdAt
|
string
(date-time)
|
リソース作成のタイムスタンプ (UTC)。
|
|
createdBy
|
string
|
リソースを作成した ID。
|
|
createdByType
|
createdByType
|
リソースを作成した ID の種類。
|
|
lastModifiedAt
|
string
(date-time)
|
リソースの最終変更のタイムスタンプ (UTC)
|
|
lastModifiedBy
|
string
|
リソースを最後に変更した ID。
|
|
lastModifiedByType
|
createdByType
|
リソースを最後に変更した ID の種類。
|
UserAssignedIdentity
Object
ユーザー割り当て ID プロパティ
| 名前 |
型 |
説明 |
|
clientId
|
string
(uuid)
|
割り当てられた ID のクライアント ID。
|
|
principalId
|
string
(uuid)
|
割り当てられた ID のプリンシパル ID。
|