Create or update a session pool with the given properties.
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/sessionPools/{sessionPoolName}?api-version=2025-07-01
URI Parameters
| Name |
In |
Required |
Type |
Description |
|
resourceGroupName
|
path |
True
|
string
minLength: 1 maxLength: 90
|
The name of the resource group. The name is case insensitive.
|
|
sessionPoolName
|
path |
True
|
string
minLength: 3 maxLength: 63 pattern: ^[a-z][a-z0-9]*$
|
Name of the session pool.
|
|
subscriptionId
|
path |
True
|
string
(uuid)
|
The ID of the target subscription. The value must be an UUID.
|
|
api-version
|
query |
True
|
string
minLength: 1
|
The API version to use for this operation.
|
Request Body
| Name |
Required |
Type |
Description |
|
location
|
True
|
string
|
The geo-location where the resource lives
|
|
identity
|
|
ManagedServiceIdentity
|
Managed identities needed by a session pool to interact with other Azure services to not maintain any secrets or credentials in code.
|
|
properties.containerType
|
|
ContainerType
|
The container type of the sessions.
|
|
properties.customContainerTemplate
|
|
CustomContainerTemplate
|
The custom container configuration if the containerType is CustomContainer.
|
|
properties.dynamicPoolConfiguration
|
|
DynamicPoolConfiguration
|
The pool configuration if the poolManagementType is dynamic.
|
|
properties.environmentId
|
|
string
(arm-id)
|
Resource ID of the session pool's environment.
|
|
properties.managedIdentitySettings
|
|
ManagedIdentitySetting[]
|
Optional settings for a Managed Identity that is assigned to the Session pool.
|
|
properties.poolManagementType
|
|
PoolManagementType
|
The pool management type of the session pool.
|
|
properties.scaleConfiguration
|
|
ScaleConfiguration
|
The scale configuration of the session pool.
|
|
properties.secrets
|
|
SessionPoolSecret[]
|
The secrets of the session pool.
|
|
properties.sessionNetworkConfiguration
|
|
SessionNetworkConfiguration
|
The network configuration of the sessions in the session pool.
|
|
tags
|
|
object
|
Resource tags.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
| Name |
Description |
|
user_impersonation
|
impersonate your user account
|
Examples
Create or Update Session Pool with lifecycle OnContainerExit Timed
Sample request
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool?api-version=2025-07-01
{
"location": "East US",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
]
}
}
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.IdentitySettingsLifeCycle;
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.SessionRegistryCredentials;
import java.util.Arrays;
/**
* Samples for ContainerAppsSessionPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/
* 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(IdentitySettingsLifeCycle.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="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
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: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/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/v4"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b2965096067d6f8374b5485b0568fd36e7c9d099/specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/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("<subscription-id>", 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"),
Identity: &armappcontainers.ManagedServiceIdentity{
Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
},
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.IdentitySettingsLifeCycleMain),
}},
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 pull 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.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"),
// Identity: &armappcontainers.ManagedServiceIdentity{
// Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("bce8c037-3d10-44a4-a970-25f799611fc6"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// 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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.AppContainers.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.AppContainers;
// Generated from example definition: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/SessionPools_LifecycleOnContainerExit_CreateOrUpdate.json
// this example is just showing the usage of "ContainerAppsSessionPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
string resourceGroupName = "rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SessionPoolResource
SessionPoolCollection collection = resourceGroupResource.GetSessionPools();
// invoke the operation
string sessionPoolName = "testsessionpool";
SessionPoolData data = new SessionPoolData(new AzureLocation("East US"))
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
EnvironmentId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
ContainerType = ContainerType.CustomContainer,
PoolManagementType = PoolManagementType.Dynamic,
ScaleConfiguration = new SessionPoolScaleConfiguration
{
MaxConcurrentSessions = 500,
ReadySessionInstances = 100,
},
DynamicPoolLifecycleConfiguration = new SessionPoolLifecycleConfiguration
{
LifecycleType = SessionPoolLifecycleType.OnContainerExit,
MaxAlivePeriodInSeconds = 86400,
},
CustomContainerTemplate = new CustomContainerTemplate
{
RegistryCredentials = new SessionRegistryCredentials
{
Server = "test.azurecr.io",
Identity = "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
},
Containers = {new SessionContainer
{
Image = "repo/testcontainer:v4",
Name = "testinitcontainer",
Command = {"/bin/sh"},
Args = {"-c", "while true; do echo hello; sleep 10;done"},
Resources = new SessionContainerResources
{
Cpu = 0.25,
Memory = "0.5Gi",
},
}},
IngressTargetPort = 80,
},
SessionNetworkStatus = SessionNetworkStatus.EgressEnabled,
ManagedIdentitySettings = {new SessionPoolManagedIdentitySetting("system")
{
Lifecycle = ContainerAppIdentitySettingsLifeCycle.Main,
}},
};
ArmOperation<SessionPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sessionPoolName, data);
SessionPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SessionPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"location": "East US",
"properties": {
"provisioningState": "Succeeded",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"nodeCount": 1,
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"
},
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
}
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"location": "East US",
"properties": {
"provisioningState": "InProgress",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
]
},
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
}
Create or Update Session Pool with lifecycle type Timed
Sample request
PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool?api-version=2025-07-01
{
"location": "East US",
"identity": {
"type": "SystemAssigned"
},
"properties": {
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "OnContainerExit",
"maxAlivePeriodInSeconds": 86400
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
]
}
}
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.IdentitySettingsLifeCycle;
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.SessionRegistryCredentials;
import java.util.Arrays;
/**
* Samples for ContainerAppsSessionPools CreateOrUpdate.
*/
public final class Main {
/*
* x-ms-original-file: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/
* 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.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(IdentitySettingsLifeCycle.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="34adfa4f-cedf-4dc0-ba29-b6d1a69ab345",
)
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: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/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/v4"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/b2965096067d6f8374b5485b0568fd36e7c9d099/specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/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("<subscription-id>", 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"),
Identity: &armappcontainers.ManagedServiceIdentity{
Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
},
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.IdentitySettingsLifeCycleMain),
}},
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 pull 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.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"),
// Identity: &armappcontainers.ManagedServiceIdentity{
// Type: to.Ptr(armappcontainers.ManagedServiceIdentityTypeSystemAssigned),
// PrincipalID: to.Ptr("bce8c037-3d10-44a4-a970-25f799611fc6"),
// TenantID: to.Ptr("72f988bf-86f1-41af-91ab-2d7cd011db47"),
// },
// 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.LifecycleTypeTimed),
// MaxAlivePeriodInSeconds: to.Ptr[int32](600),
// },
// },
// 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
using Azure;
using Azure.ResourceManager;
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager.AppContainers.Models;
using Azure.ResourceManager.Models;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.AppContainers;
// Generated from example definition: specification/app/resource-manager/Microsoft.App/ContainerApps/stable/2025-07-01/examples/SessionPools_LifecycleTimed_CreateOrUpdate.json
// this example is just showing the usage of "ContainerAppsSessionPools_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this ResourceGroupResource created on azure
// for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource
string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345";
string resourceGroupName = "rg";
ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
// get the collection of this SessionPoolResource
SessionPoolCollection collection = resourceGroupResource.GetSessionPools();
// invoke the operation
string sessionPoolName = "testsessionpool";
SessionPoolData data = new SessionPoolData(new AzureLocation("East US"))
{
Identity = new ManagedServiceIdentity("SystemAssigned"),
EnvironmentId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube"),
ContainerType = ContainerType.CustomContainer,
PoolManagementType = PoolManagementType.Dynamic,
ScaleConfiguration = new SessionPoolScaleConfiguration
{
MaxConcurrentSessions = 500,
ReadySessionInstances = 100,
},
DynamicPoolLifecycleConfiguration = new SessionPoolLifecycleConfiguration
{
LifecycleType = SessionPoolLifecycleType.OnContainerExit,
MaxAlivePeriodInSeconds = 86400,
},
CustomContainerTemplate = new CustomContainerTemplate
{
RegistryCredentials = new SessionRegistryCredentials
{
Server = "test.azurecr.io",
Identity = "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP",
},
Containers = {new SessionContainer
{
Image = "repo/testcontainer:v4",
Name = "testinitcontainer",
Command = {"/bin/sh"},
Args = {"-c", "while true; do echo hello; sleep 10;done"},
Resources = new SessionContainerResources
{
Cpu = 0.25,
Memory = "0.5Gi",
},
}},
IngressTargetPort = 80,
},
SessionNetworkStatus = SessionNetworkStatus.EgressEnabled,
ManagedIdentitySettings = {new SessionPoolManagedIdentitySetting("system")
{
Lifecycle = ContainerAppIdentitySettingsLifeCycle.Main,
}},
};
ArmOperation<SessionPoolResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sessionPoolName, data);
SessionPoolResource result = lro.Value;
// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
SessionPoolData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"location": "East US",
"properties": {
"provisioningState": "Succeeded",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"nodeCount": 1,
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "Timed",
"maxAlivePeriodInSeconds": 600
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io"
},
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
}
{
"id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/sessionPools/testsessionpool",
"name": "testsessionpool",
"type": "Microsoft.App/sessionPools",
"location": "East US",
"properties": {
"provisioningState": "InProgress",
"environmentId": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.App/managedEnvironments/demokube",
"poolManagementType": "Dynamic",
"containerType": "CustomContainer",
"scaleConfiguration": {
"maxConcurrentSessions": 500,
"readySessionInstances": 100
},
"dynamicPoolConfiguration": {
"lifecycleConfiguration": {
"lifecycleType": "Timed",
"maxAlivePeriodInSeconds": 600
}
},
"customContainerTemplate": {
"containers": [
{
"image": "repo/testcontainer:v4",
"name": "testinitcontainer",
"resources": {
"cpu": 0.25,
"memory": "0.5Gi"
},
"command": [
"/bin/sh"
],
"args": [
"-c",
"while true; do echo hello; sleep 10;done"
]
}
],
"ingress": {
"targetPort": 80
},
"registryCredentials": {
"server": "test.azurecr.io",
"identity": "/subscriptions/7a497526-bb8d-4816-9795-db1418a1f977/resourcegroups/test/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testSP"
}
},
"sessionNetworkConfiguration": {
"status": "EgressEnabled"
},
"poolManagementEndpoint": "https://testsessionpool.agreeableriver-3d30edf1.eastus.azurecontainerapps.io",
"managedIdentitySettings": [
{
"identity": "system",
"lifecycle": "Main"
}
]
},
"identity": {
"type": "SystemAssigned",
"principalId": "bce8c037-3d10-44a4-a970-25f799611fc6",
"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47"
}
}
Definitions
ContainerType
Enumeration
The container type of the sessions.
| Value |
Description |
|
CustomContainer
|
|
|
PythonLTS
|
|
createdByType
Enumeration
The type of identity that created the resource.
| Value |
Description |
|
User
|
|
|
Application
|
|
|
ManagedIdentity
|
|
|
Key
|
|
CustomContainerTemplate
Object
Custom container configuration.
| Name |
Type |
Description |
|
containers
|
SessionContainer[]
|
List of container definitions for the sessions of the session pool.
|
|
ingress
|
SessionIngress
|
Session pool ingress configuration.
|
|
registryCredentials
|
SessionRegistryCredentials
|
Private container registry credentials for containers used by the sessions of the session pool.
|
DynamicPoolConfiguration
Object
Dynamic pool configuration.
| Name |
Type |
Description |
|
lifecycleConfiguration
|
LifecycleConfiguration
|
The lifecycle configuration of a session in the dynamic session pool
|
EnvironmentVar
Object
Container App container environment variable.
| Name |
Type |
Description |
|
name
|
string
|
Environment variable name.
|
|
secretRef
|
string
|
Name of the Container App secret from which to pull the environment variable value.
|
|
value
|
string
|
Non-secret environment variable value.
|
ErrorAdditionalInfo
Object
The resource management error additional info.
| Name |
Type |
Description |
|
info
|
object
|
The additional info.
|
|
type
|
string
|
The additional info type.
|
ErrorDetail
Object
The error detail.
| Name |
Type |
Description |
|
additionalInfo
|
ErrorAdditionalInfo[]
|
The error additional info.
|
|
code
|
string
|
The error code.
|
|
details
|
ErrorDetail[]
|
The error details.
|
|
message
|
string
|
The error message.
|
|
target
|
string
|
The error target.
|
ErrorResponse
Object
Error response
| Name |
Type |
Description |
|
error
|
ErrorDetail
|
The error object.
|
IdentitySettingsLifeCycle
Enumeration
Use to select the lifecycle stages of a Session Pool during which the Managed Identity should be available.
| Value |
Description |
|
None
|
|
|
Main
|
|
LifecycleConfiguration
Object
The lifecycle configuration properties of a session in the dynamic session pool
| Name |
Type |
Description |
|
cooldownPeriodInSeconds
|
integer
(int32)
|
The cooldown period of a session in seconds when the lifecycle type is 'Timed'.
|
|
lifecycleType
|
LifecycleType
|
The lifecycle type of the session pool.
|
|
maxAlivePeriodInSeconds
|
integer
(int32)
|
The maximum alive period of a session in seconds when the lifecycle type is 'OnContainerExit'.
|
LifecycleType
Enumeration
The lifecycle type of the session pool.
| Value |
Description |
|
Timed
|
|
|
OnContainerExit
|
|
ManagedIdentitySetting
Object
Optional settings for a Managed Identity that is assigned to the Session pool.
| Name |
Type |
Default value |
Description |
|
identity
|
string
|
|
The resource ID of a user-assigned managed identity that is assigned to the Session Pool, or 'system' for system-assigned identity.
|
|
lifecycle
|
IdentitySettingsLifeCycle
|
None
|
Use to select the lifecycle stages of a Session Pool during which the Managed Identity should be available.
|
ManagedServiceIdentity
Object
Managed service identity (system assigned and/or user assigned identities)
| Name |
Type |
Description |
|
principalId
|
string
(uuid)
|
The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.
|
|
tenantId
|
string
(uuid)
|
The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.
|
|
type
|
ManagedServiceIdentityType
|
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
|
|
userAssignedIdentities
|
<string,
UserAssignedIdentity>
|
User-Assigned Identities
The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.
|
ManagedServiceIdentityType
Enumeration
Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).
| Value |
Description |
|
None
|
|
|
SystemAssigned
|
|
|
UserAssigned
|
|
|
SystemAssigned,UserAssigned
|
|
PoolManagementType
Enumeration
The pool management type of the session pool.
| Value |
Description |
|
Manual
|
|
|
Dynamic
|
|
ScaleConfiguration
Object
Scale configuration.
| Name |
Type |
Description |
|
maxConcurrentSessions
|
integer
(int32)
|
The maximum count of sessions at the same time.
|
|
readySessionInstances
|
integer
(int32)
|
The minimum count of ready session instances.
|
SessionContainer
Object
Container definitions for the sessions of the session pool.
| Name |
Type |
Description |
|
args
|
string[]
|
Container start command arguments.
|
|
command
|
string[]
|
Container start command.
|
|
env
|
EnvironmentVar[]
|
Container environment variables.
|
|
image
|
string
|
Container image tag.
|
|
name
|
string
|
Custom container name.
|
|
resources
|
SessionContainerResources
|
Container resource requirements.
|
SessionContainerResources
Object
Container resource requirements for sessions of the session pool.
| Name |
Type |
Description |
|
cpu
|
number
(double)
|
Required CPU in cores, e.g. 0.5
|
|
memory
|
string
|
Required memory, e.g. "250Mb"
|
SessionIngress
Object
Session pool ingress configuration.
| Name |
Type |
Description |
|
targetPort
|
integer
(int32)
|
Target port in containers for traffic from ingress
|
SessionNetworkConfiguration
Object
Session network configuration.
SessionNetworkStatus
Enumeration
Network status for the sessions.
| Value |
Description |
|
EgressEnabled
|
|
|
EgressDisabled
|
|
SessionPool
Object
Container App session pool.
| Name |
Type |
Description |
|
id
|
string
(arm-id)
|
Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"
|
|
identity
|
ManagedServiceIdentity
|
Managed identities needed by a session pool to interact with other Azure services to not maintain any secrets or credentials in code.
|
|
location
|
string
|
The geo-location where the resource lives
|
|
name
|
string
|
The name of the resource
|
|
properties.containerType
|
ContainerType
|
The container type of the sessions.
|
|
properties.customContainerTemplate
|
CustomContainerTemplate
|
The custom container configuration if the containerType is CustomContainer.
|
|
properties.dynamicPoolConfiguration
|
DynamicPoolConfiguration
|
The pool configuration if the poolManagementType is dynamic.
|
|
properties.environmentId
|
string
(arm-id)
|
Resource ID of the session pool's environment.
|
|
properties.managedIdentitySettings
|
ManagedIdentitySetting[]
|
Optional settings for a Managed Identity that is assigned to the Session pool.
|
|
properties.nodeCount
|
integer
(int32)
|
The number of nodes the session pool is using.
|
|
properties.poolManagementEndpoint
|
string
(uri)
|
The endpoint to manage the pool.
|
|
properties.poolManagementType
|
PoolManagementType
|
The pool management type of the session pool.
|
|
properties.provisioningState
|
SessionPoolProvisioningState
|
Provisioning state of the session pool.
|
|
properties.scaleConfiguration
|
ScaleConfiguration
|
The scale configuration of the session pool.
|
|
properties.secrets
|
SessionPoolSecret[]
|
The secrets of the session pool.
|
|
properties.sessionNetworkConfiguration
|
SessionNetworkConfiguration
|
The network configuration of the sessions in the session pool.
|
|
systemData
|
systemData
|
Azure Resource Manager metadata containing createdBy and modifiedBy information.
|
|
tags
|
object
|
Resource tags.
|
|
type
|
string
|
The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
|
SessionPoolProvisioningState
Enumeration
Provisioning state of the session pool.
| Value |
Description |
|
InProgress
|
|
|
Succeeded
|
|
|
Failed
|
|
|
Canceled
|
|
|
Deleting
|
|
SessionPoolSecret
Object
Secret definition.
| Name |
Type |
Description |
|
name
|
string
|
Secret Name.
|
|
value
|
string
|
Secret Value.
|
SessionRegistryCredentials
Object
Session pool private registry credentials.
| Name |
Type |
Description |
|
identity
|
string
|
A Managed Identity to use to authenticate with Azure Container Registry. For user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned identities, use 'system'
|
|
passwordSecretRef
|
string
|
The name of the secret that contains the registry login password
|
|
server
|
string
|
Container registry server.
|
|
username
|
string
|
Container registry username.
|
systemData
Object
Metadata pertaining to creation and last modification of the resource.
| Name |
Type |
Description |
|
createdAt
|
string
(date-time)
|
The timestamp of resource creation (UTC).
|
|
createdBy
|
string
|
The identity that created the resource.
|
|
createdByType
|
createdByType
|
The type of identity that created the resource.
|
|
lastModifiedAt
|
string
(date-time)
|
The timestamp of resource last modification (UTC)
|
|
lastModifiedBy
|
string
|
The identity that last modified the resource.
|
|
lastModifiedByType
|
createdByType
|
The type of identity that last modified the resource.
|
UserAssignedIdentity
Object
User assigned identity properties
| Name |
Type |
Description |
|
clientId
|
string
(uuid)
|
The client ID of the assigned identity.
|
|
principalId
|
string
(uuid)
|
The principal ID of the assigned identity.
|