Docker容器中az bot create因schemaTransformationVersion=0.0报错的解决问询
问题:Docker容器中执行
az bot create报schemaTransformationVersion不支持错误 问题详情
在Alpine Linux 3.16的Docker容器中执行以下Azure CLI命令创建Bot:
az bot create ` --app-type $appType ` --appid $appInfo.AppId ` --name $botName ` --resource-group $resourceGroupName ` --endpoint $messagingEndpoint ` --sku $sku
参数说明:
$appType为"MultiTenant"$appInfo.AppId来自有效应用注册的Get-AzADApplication结果- 其余参数均为有效值
执行后报错:
(InvalidBotData) Bot is not valid. Errors: The schema transformation version is not supported. Code: InvalidBotData Message: Bot is not valid. Errors: The schema transformation version is not supported.
启用--debug后发现核心差异:
- 容器中发送的请求体自动包含
"schemaTransformationVersion":"0.0"参数 - 本地环境执行时该参数不存在,命令可正常运行
已尝试的排查步骤
- 更换Azure CLI版本(2.38.0至2.43.0)
- 更换PowerShell、Python版本
- 指定租户ID登录
- 确认应用注册信息及其他参数有效性
- 此前容器可正常执行该命令,2022年12月2日重建容器后出现问题
容器环境:Alpine Linux v3.16,PowerShell 7.3.0,Azure CLI 2.43.0,已安装最新Az及Az.BotService模块,OpenSSL 1.1.1s,Python 3.10.8
解决建议
检查并对齐Bot Service扩展版本
az bot命令由botservice扩展提供,容器与本地的扩展版本可能不一致。执行以下命令查看版本:az extension show --name botservice将容器内的扩展版本降级/升级至与本地一致,执行:
az extension update --name botservice --version <本地版本号> # 或降级 az extension add --name botservice --version <目标版本号> --force清理Azure CLI缓存
容器重建后可能残留旧配置缓存,执行缓存清理:az cache purge # 或直接删除缓存目录 rm -rf ~/.azure清理后重新登录Azure再执行命令。
排除Az模块冲突
容器中安装的Az.BotService模块可能与Azure CLI的botservice扩展存在冲突,尝试卸载该模块后测试:Uninstall-Module -Name Az.BotService -Force指定API版本执行命令
尝试手动指定与本地一致的API版本(可从本地--debug日志中找到),例如:az bot create ` --app-type $appType ` --appid $appInfo.AppId ` --name $botName ` --resource-group $resourceGroupName ` --endpoint $messagingEndpoint ` --sku $sku ` --api-version 2022-09-15检查环境变量差异
对比本地与容器的环境变量,排查是否存在AZURE_*开头的特殊变量影响了请求体构造,可通过env | grep AZURE查看容器内相关变量,移除可疑变量后测试。
内容的提问来源于stack exchange,提问作者Alex Bishka
相关产品推荐
相关产品推荐

