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

使用Azure CLI创建WebApp报错:‘6.0’未被识别为命令

解决Azure CLI创建Web应用时‘6.0’未被识别的错误

问题原因

报错是因为命令里的|符号在Windows的CMD/PowerShell中是管道运算符,系统会将其解析为把前半部分命令的输出传给后续命令,导致6.0被当成独立命令执行,从而触发错误。

解决方案

以下三种方法任选其一即可:

  • 修改运行时参数格式
    Azure CLI支持用冒号替代管道符指定运行时,或者直接使用合并后的格式,修正后的命令:

    az webapp create -n testwebapp1 -g test-rg1 -p s1 -r "DOTNETCORE:6.0"
    

    或者更简洁的写法:

    az webapp create -n testwebapp1 -g test-rg1 -p s1 -r dotnetcore6.0
    
  • 在PowerShell中转义管道符
    如果要保留|格式,在PowerShell中用反引号`转义管道符即可:

    az webapp create -n testwebapp1 -g test-rg1 -p s1 -r "dotnetcore`|6.0"
    
  • 使用类Unix环境执行命令
    在WSL、Git Bash等类Unix终端中,管道符不会被系统提前解析,直接运行原命令即可:

    az webapp create -n testwebapp1 -g test-rg1 -p s1 -r "dotnetcore|6.0"
    

额外验证

执行命令前可以先运行az webapp list-runtimes查看Azure支持的运行时格式,确保参数符合要求。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 14:20:54