你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

az containerapp sessionpool

Note

This reference is part of the containerapp extension for the Azure CLI (version 2.62.0 or higher). 该扩展将在首次运行 az containerapp sessionpool 命令时自动安装。 Learn more about extensions.

用于管理会话池的命令。

命令

名称 说明 类型 Status
az containerapp sessionpool create

创建或更新会话池。

Extension GA
az containerapp sessionpool delete

删除会话池。

Extension GA
az containerapp sessionpool list

按订阅或资源组列出会话池。

Extension GA
az containerapp sessionpool show

显示会话池的详细信息。

Extension GA
az containerapp sessionpool update

更新会话池。

Extension GA

az containerapp sessionpool create

创建或更新会话池。

az containerapp sessionpool create --name
                                   --resource-group
                                   [--args]
                                   [--command]
                                   [--container-name]
                                   [--container-type {CustomContainer, NodeLTS, PythonLTS}]
                                   [--cooldown-period]
                                   [--cpu]
                                   [--env-vars]
                                   [--environment]
                                   [--image]
                                   [--location]
                                   [--max-sessions]
                                   [--memory]
                                   [--mi-system-assigned]
                                   [--mi-user-assigned]
                                   [--network-status {EgressDisabled, EgressEnabled}]
                                   [--no-wait]
                                   [--ready-sessions]
                                   [--registry-identity]
                                   [--registry-password]
                                   [--registry-server]
                                   [--registry-username]
                                   [--secrets]
                                   [--target-port]

示例

使用容器类型 PythonLTS 默认设置创建或更新会话池。

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --location eastasia

使用容器类型 PythonLTS 创建或更新会话池,最大并发会话数为 30,就绪会话实例 20。

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type PythonLTS --max-sessions 30 --ready-sessions 20 \
    --location eastasia

使用默认快速入门映像创建或更新容器类型 CustomContainer 的会话池。

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type CustomContainer --environment MyEnvironment \
    --cpu 0.5 --memory 1Gi --target-port 80 --location eastasia --image mcr.microsoft.com/k8se/quickstart:latest

使用具有机密和环境变量的容器类型 CustomContainer 创建或更新会话池。

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type CustomContainer --environment MyEnvironment \
    --cpu 0.5 --memory 1Gi --target-port 80 --image MyImage \
    --env-vars GREETING="Hello, world" SECRETENV=secretref:anothersecret \
    --secrets mysecret=secretvalue1 anothersecret="secret value 2" --location eastasia

使用从专用注册表创建的容器类型 CustomContainer 创建或更新会话池

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type CustomContainer --environment MyEnvironment --image MyImage \
    --cpu 0.5 --memory 1Gi --target-port 80 --registry-server myregistry.azurecr.io \
    --registry-username myregistry --registry-password $REGISTRY_PASSWORD \
    --location eastasia

使用容器类型 CustomContainer 和托管标识创建或更新会话池,以对 Azure 容器注册表进行身份验证

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type CustomContainer --environment MyEnvironment --image MyImage \
    --cpu 0.5 --memory 1Gi --target-port 80 --registry-server myregistry.azurecr.io \
    --registry-identity  MyUserIdentityResourceId \
    --location eastasia

使用容器类型 CustomContainer 创建或更新会话池,其中包含系统分配的标识和用户分配的标识。

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --container-type CustomContainer --environment MyEnvironment --image MyImage \
    --cpu 0.5 --memory 1Gi --target-port 80 \
    --mi-system-assigned --mi-user-assigned MyUserIdentityResourceId \
    --location eastasia

使用容器类型 CustomContainer 创建或更新会话池,其冷却期为 360s

az containerapp sessionpool create -n mysessionpool -g MyResourceGroup \
    --environment MyEnvironment --cpu 0.5 --memory 1Gi --target-port 80 --container-type CustomContainer \
    --cooldown-period 360 --location eastasia

必需参数

--name -n

会话池名称。

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--args

容器启动命令参数的列表。 空格分隔的值,例如“-c”“mycommand”。 用于清除现有值的空字符串。

属性
Parameter group: Container Arguments
--command

将在启动期间执行的容器上支持的命令列表。 空格分隔的值,例如“/bin/queue”“mycommand”。 用于清除现有值的空字符串。

属性
Parameter group: Container Arguments
--container-name

容器的名称。 如果未提供容器名称,则创建时,容器名称将默认为覆盖为小写的会话池的名称。

属性
Parameter group: Container Arguments
--container-type

会话池的池类型,默认值为“PythonLTS”。

属性
Parameter group: Configuration Arguments
接受的值: CustomContainer, NodeLTS, PythonLTS
--cooldown-period

句点(以秒为单位),之后将删除会话,默认值为 300。

属性
Parameter group: Configuration Arguments
--cpu

核心中所需的 CPU(从 0.25 到 2.0),例如 0.5。

属性
Parameter group: Container Arguments
--env-vars

容器的环境变量列表。 以“key=value”格式分隔的空间值。 用于清除现有值的空字符串。 前缀值为“secretref:”以引用机密。

属性
Parameter group: Container Arguments
--environment

容器应用环境的名称或资源 ID。

属性
Parameter group: Container Arguments
--image -i

容器映像,例如 publisher/image-name:tag。

属性
Parameter group: Container Arguments
--location -l

Location. az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--max-sessions

可以同时运行最大会话计数。

属性
Parameter group: Scale Arguments
--memory

0.5 - 4.0 的必需内存以“Gi”结尾,例如 1.0Gi。

属性
Parameter group: Container Arguments
--mi-system-assigned

指示是否分配系统分配标识的布尔值。

属性
默认值: False
--mi-user-assigned

要分配的空间分隔用户标识。

--network-status

已为会话启用出口。

属性
Parameter group: Configuration Arguments
接受的值: EgressDisabled, EgressEnabled
--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--ready-sessions

在会话池中随时准备就绪的会话数。

属性
Parameter group: Scale Arguments
--registry-identity

要向Azure 容器注册表(而不是用户名/密码)进行身份验证的托管标识。 对系统分配的标识使用“system”,对用户分配的标识使用资源 ID。 在部署之前,应为托管标识分配 ACR 的 acrpull 权限(使用“az role assignment create --role acrpull ...”)。

属性
Parameter group: Registry Arguments
--registry-password

登录到容器注册表的密码。 如果存储为机密,则值必须以“secretref:”开头,后跟机密名称。

属性
Parameter group: Registry Arguments
--registry-server

容器注册表服务器主机名,例如 myregistry.azurecr.io。

属性
Parameter group: Registry Arguments
--registry-username

要登录到容器注册表的用户名。

属性
Parameter group: Registry Arguments
--secrets -s

会话池的机密列表。 以“key=value”格式分隔的空间值。 用于清除现有值的空字符串。

属性
Parameter group: Configuration Arguments
--target-port

用于入口流量的会话端口。

属性
Parameter group: Container Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az containerapp sessionpool delete

删除会话池。

az containerapp sessionpool delete --resource-group
                                   [--ids]
                                   [--name]
                                   [--no-wait]
                                   [--subscription]
                                   [--yes]

示例

删除会话池。

az containerapp sessionpool delete -n mysessionpool -g MyResourceGroup

必需参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
Parameter group: Resource Id Arguments
--name -n

会话池名称。

属性
Parameter group: Resource Id Arguments
--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
Parameter group: Resource Id Arguments
--yes -y

不要提示确认。

属性
默认值: False
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az containerapp sessionpool list

按订阅或资源组列出会话池。

az containerapp sessionpool list [--resource-group]

示例

列出当前订阅中的会话池。

az containerapp sessionpool list

按资源组列出会话池。

az containerapp sessionpool list -g MyResourceGroup

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az containerapp sessionpool show

显示会话池的详细信息。

az containerapp sessionpool show --resource-group
                                 [--ids]
                                 [--name]
                                 [--subscription]

示例

显示会话池的详细信息。

az containerapp sessionpool show -n mysessionpool -g MyResourceGroup

必需参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
Parameter group: Resource Id Arguments
--name -n

会话池名称。

属性
Parameter group: Resource Id Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
Parameter group: Resource Id Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False

az containerapp sessionpool update

更新会话池。

az containerapp sessionpool update --resource-group
                                   [--args]
                                   [--command]
                                   [--container-name]
                                   [--cooldown-period]
                                   [--cpu]
                                   [--env-vars]
                                   [--ids]
                                   [--image]
                                   [--location]
                                   [--max-sessions]
                                   [--memory]
                                   [--mi-system-assigned]
                                   [--mi-user-assigned]
                                   [--name]
                                   [--network-status {EgressDisabled, EgressEnabled}]
                                   [--no-wait]
                                   [--ready-sessions]
                                   [--registry-identity]
                                   [--registry-password]
                                   [--registry-server]
                                   [--registry-username]
                                   [--secrets]
                                   [--subscription]
                                   [--target-port]

示例

更新会话池的最大并发会话配置和映像。

az containerapp sessionpool update -n mysessionpool -g MyResourceGroup --max-sessions 20 --image MyNewImage

必需参数

--resource-group -g

资源组的名称。 可以使用 az configure --defaults group=<name>配置默认组。

可选参数

The following parameters are optional, but depending on the context, one or more might become required for the command to execute successfully.

--args

容器启动命令参数的列表。 空格分隔的值,例如“-c”“mycommand”。 用于清除现有值的空字符串。

属性
Parameter group: Container Arguments
--command

将在启动期间执行的容器上支持的命令列表。 空格分隔的值,例如“/bin/queue”“mycommand”。 用于清除现有值的空字符串。

属性
Parameter group: Container Arguments
--container-name

容器的名称。 如果未提供容器名称,则创建时,容器名称将默认为覆盖为小写的会话池的名称。

属性
Parameter group: Container Arguments
--cooldown-period

句点(以秒为单位),之后将删除会话,默认值为 300。

属性
Parameter group: Configuration Arguments
--cpu

核心中所需的 CPU(从 0.25 到 2.0),例如 0.5。

属性
Parameter group: Container Arguments
--env-vars

容器的环境变量列表。 以“key=value”格式分隔的空间值。 用于清除现有值的空字符串。 前缀值为“secretref:”以引用机密。

属性
Parameter group: Container Arguments
--ids

一个或多个资源 ID(以空格分隔)。 它应该是包含“Resource Id”参数的所有信息的完整资源 ID。 应提供 --ids 或其他“Resource Id”参数。

属性
Parameter group: Resource Id Arguments
--image -i

容器映像,例如 publisher/image-name:tag。

属性
Parameter group: Container Arguments
--location -l

Location. az account list-locations 中的值。 可以使用 az configure --defaults location=<location> 配置默认位置。

--max-sessions

可以同时运行最大会话计数。

属性
Parameter group: Scale Arguments
--memory

0.5 - 4.0 的必需内存以“Gi”结尾,例如 1.0Gi。

属性
Parameter group: Container Arguments
--mi-system-assigned

指示是否分配系统分配标识的布尔值。

属性
默认值: False
--mi-user-assigned

要分配的空间分隔用户标识。

--name -n

会话池名称。

属性
Parameter group: Resource Id Arguments
--network-status

已为会话启用出口。

属性
Parameter group: Configuration Arguments
接受的值: EgressDisabled, EgressEnabled
--no-wait

不等待长时间运行的操作完成。

属性
默认值: False
--ready-sessions

在会话池中随时准备就绪的会话数。

属性
Parameter group: Scale Arguments
--registry-identity

要向Azure 容器注册表(而不是用户名/密码)进行身份验证的托管标识。 对系统分配的标识使用“system”,对用户分配的标识使用资源 ID。 在部署之前,应为托管标识分配 ACR 的 acrpull 权限(使用“az role assignment create --role acrpull ...”)。

属性
Parameter group: Registry Arguments
--registry-password

登录到容器注册表的密码。 如果存储为机密,则值必须以“secretref:”开头,后跟机密名称。

属性
Parameter group: Registry Arguments
--registry-server

容器注册表服务器主机名,例如 myregistry.azurecr.io。

属性
Parameter group: Registry Arguments
--registry-username

要登录到容器注册表的用户名。

属性
Parameter group: Registry Arguments
--secrets -s

会话池的机密列表。 以“key=value”格式分隔的空间值。 用于清除现有值的空字符串。

属性
Parameter group: Configuration Arguments
--subscription

订阅的名称或 ID。 可以使用 az account set -s NAME_OR_ID 配置默认订阅。

属性
Parameter group: Resource Id Arguments
--target-port

用于入口流量的会话端口。

属性
Parameter group: Container Arguments
全局参数
--debug

提高日志记录详细程度以显示所有调试日志。

属性
默认值: False
--help -h

显示此帮助消息并退出。

--only-show-errors

仅显示错误,禁止显示警告。

属性
默认值: False
--output -o

Output format.

属性
默认值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查询字符串。 有关更多信息和示例,请参阅 http://jmespath.org/

--verbose

增加日志记录详细程度。 使用 --debug 获取完整的调试日志。

属性
默认值: False