Share via


Container Apps Session Pools - Create Or Update

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

Name Type Description
200 OK

SessionPool

Update succeeded

201 Created

SessionPool

Session pool creation has started.

Other Status Codes

ErrorResponse

Common error response.

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
Create or Update Session Pool with lifecycle type Timed

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"
      }
    ]
  }
}

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"
      }
    ]
  }
}

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

Name Description
ContainerType

The container type of the sessions.

createdByType

The type of identity that created the resource.

CustomContainerTemplate

Custom container configuration.

DynamicPoolConfiguration

Dynamic pool configuration.

EnvironmentVar

Container App container environment variable.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

IdentitySettingsLifeCycle

Use to select the lifecycle stages of a Session Pool during which the Managed Identity should be available.

LifecycleConfiguration

The lifecycle configuration properties of a session in the dynamic session pool

LifecycleType

The lifecycle type of the session pool.

ManagedIdentitySetting

Optional settings for a Managed Identity that is assigned to the Session pool.

ManagedServiceIdentity

Managed service identity (system assigned and/or user assigned identities)

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

PoolManagementType

The pool management type of the session pool.

ScaleConfiguration

Scale configuration.

SessionContainer

Container definitions for the sessions of the session pool.

SessionContainerResources

Container resource requirements for sessions of the session pool.

SessionIngress

Session pool ingress configuration.

SessionNetworkConfiguration

Session network configuration.

SessionNetworkStatus

Network status for the sessions.

SessionPool

Container App session pool.

SessionPoolProvisioningState

Provisioning state of the session pool.

SessionPoolSecret

Secret definition.

SessionRegistryCredentials

Session pool private registry credentials.

systemData

Metadata pertaining to creation and last modification of the resource.

UserAssignedIdentity

User assigned identity properties

ContainerType

The container type of the sessions.

Value Description
CustomContainer
PythonLTS

createdByType

The type of identity that created the resource.

Value Description
User
Application
ManagedIdentity
Key

CustomContainerTemplate

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

Dynamic pool configuration.

Name Type Description
lifecycleConfiguration

LifecycleConfiguration

The lifecycle configuration of a session in the dynamic session pool

EnvironmentVar

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

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

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

Error response

Name Type Description
error

ErrorDetail

The error object.

IdentitySettingsLifeCycle

Use to select the lifecycle stages of a Session Pool during which the Managed Identity should be available.

Value Description
None
Main

LifecycleConfiguration

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

The lifecycle type of the session pool.

Value Description
Timed
OnContainerExit

ManagedIdentitySetting

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

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

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

Value Description
None
SystemAssigned
UserAssigned
SystemAssigned,UserAssigned

PoolManagementType

The pool management type of the session pool.

Value Description
Manual
Dynamic

ScaleConfiguration

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

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

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

Session pool ingress configuration.

Name Type Description
targetPort

integer (int32)

Target port in containers for traffic from ingress

SessionNetworkConfiguration

Session network configuration.

Name Type Description
status

SessionNetworkStatus

Network status for the sessions.

SessionNetworkStatus

Network status for the sessions.

Value Description
EgressEnabled
EgressDisabled

SessionPool

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

Provisioning state of the session pool.

Value Description
InProgress
Succeeded
Failed
Canceled
Deleting

SessionPoolSecret

Secret definition.

Name Type Description
name

string

Secret Name.

value

string

Secret Value.

SessionRegistryCredentials

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

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

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.