You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为Azure容器应用配置Redis服务连接器(系统身份+免重启)

解决方案

要在不重启Redis缓存的前提下,为Azure容器应用配置基于现有连接串、使用系统身份的Redis服务连接器,可使用以下CLI命令:

az containerapp connection create redis \
  -g ${GROUP} \
  -n ${SERVICE}-demo \
  --connection redis_connection \
  --server "${REDIS_SERVER}" \
  --database 0 \
  --client-type python \
  --system-identity \
  --connection-string secretref:redis-connectionstring \
  --no-configure-redis

参数说明

  • --connection-string secretref:redis-connectionstring:直接引用容器应用中已配置的redis-connectionstring密钥作为Redis连接串,无需重新创建或指定明文连接串。
  • --no-configure-redis:跳过对Redis实例的自动配置(如启用Microsoft Entra认证),彻底避免Redis重启。
  • --system-identity:指定服务连接器使用容器应用的系统身份进行自身的权限管理,而非直接用系统身份认证Redis(这也是无需修改Redis配置的关键)。

错误原因分析

  1. 尝试1失败:--secret参数用于让服务连接器自动生成或创建新的密钥,而非引用现有密钥。手动指定自定义键名会触发服务连接器的自动密钥校验逻辑,导致Unsupported Key错误。
  2. 尝试2失败:未指定连接串时,CLI默认会尝试配置系统身份直接认证Redis,这要求Redis必须启用Microsoft Entra认证,因此会提示补充参数并触发Redis重启。

验证命令

创建完成后,可通过以下命令确认连接状态:

az containerapp connection show \
  -g ${GROUP} \
  -n ${SERVICE}-demo \
  --connection redis_connection

内容的提问来源于stack exchange,提问作者Laurent LAPORTE

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 22:12:48