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

如何让Octopus的「Deploy an Azure App Service」步骤使用PowerShell Core

Octopus「Deploy an Azure App Service」步骤切换为PowerShell Core的解决办法

方案一:修改项目全局PowerShell版本

  • 打开目标项目的「设置」页面
  • 找到「PowerShell执行」选项
  • 把「默认PowerShell版本」改成「PowerShell Core 7.x」
  • 保存后,项目里所有内置步骤(包括这个Azure部署步骤)都会默认用PS7运行

方案二:给单个步骤加变量强制指定

不想改全局设置的话,针对这个步骤单独配置:

  • 进入「Deploy an Azure App Service」步骤的「变量」标签
  • 添加变量 Octopus.Action.PowerShell.ExecutionVersion,值设为 7 或 7.x(根据你的Octopus版本选合适的)
  • 保存步骤,该步骤就会强制用PowerShell Core执行

额外说明

  • 你之前的项目自动用PS7,应该是当时Octopus服务器的全局默认PowerShell版本设成了PS7,后来全局默认改回PS5导致新项目用PS5。可以去服务器「配置」→「功能」→「PowerShell」里检查全局默认设置
  • 报错 The term 'Remove-WebConfigurationLock' is not recognized 是因为PS5自带的IIS模块有这个cmdlet,但PS7没有,换成PS7后Octopus的部署脚本会用兼容逻辑替代这个操作,就能解决错误

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.07 03:52:37