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

Azure CLI执行connectedvmware vm guest-agent enable命令报'str' object is not callable错误求助

解决Az CLI connectedvmware vm guest-agent enable 报错 'str' object is not callable

从你的错误栈来看,这个问题大概率是Azure CLI的connectedvmware扩展版本兼容问题,或者是扩展内部的代码逻辑bug导致的。下面是几个针对性的解决步骤:

1. 更新connectedvmware扩展到最新版本

这个错误常见于旧版本的connectedvmware扩展中,更新扩展通常能修复这类SDK调用的问题:

# 更新扩展
az extension update --name connectedvmware

# 如果更新无效,尝试卸载后重新安装
az extension remove --name connectedvmware
az extension add --name connectedvmware

2. 更新Azure CLI核心版本

如果扩展更新后问题依旧,可能是CLI核心版本和扩展不兼容,执行全局更新:

az upgrade

3. 手动预配置VM的系统分配身份

错误栈显示问题出在enable_system_identity函数调用,也就是自动启用系统身份时失败。你可以先手动在Azure门户给目标VM启用系统分配的托管身份,然后再运行guest-agent启用命令:

  • 进入VM的「身份」设置页
  • 切换到「系统分配」标签,设置为「启用」并保存
  • 再重新执行你的CLI命令

4. 检查密码参数的转义(PowerShell环境)

因为你是在PowerShell中执行命令,如果密码包含特殊字符(比如$、&等),需要正确转义:

  • 用单引号包裹密码:--password 'your-password-with-$pecial-chars'
  • 或者用反引号转义特殊字符:--password "your-password-with-$pecial-chars"`

5. 尝试添加--no-wait参数(可选)

虽然错误是sdk_no_wait的调用问题,但显式添加--no-wait参数可能绕过这个逻辑:

az connectedvmware vm guest-agent enable --username "vm user name" --password "vm password" --resource-group "resource group name" --subscription "Name or ID of subscription" --vm-name "vm name" --no-wait

你提到其他connectedVMware命令都能正常运行,说明你的订阅、资源组、VM名称等参数都是正确的,优先尝试前面两个更新步骤,应该能解决这个问题。

内容的提问来源于stack exchange,提问作者henry-griffin

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.29 01:13:17