Azure VM:在 CI CD 管道任务中创建后停止 Azure VM

问题描述 投票:0回答:1

我已经尝试解决这个问题近两天了,我需要你的帮助。

我在 Azure DEvops 上创建了一个 Azure Pipeline,它部署了一堆资源,其中包括一个 Azure VM(我计划稍后添加更多 VM),并且我添加了一个 Azure Powershell 任务以在 YAML 中的 Terraform Apply 任务之后立即停止 VM我的管道的配置文件。

这里是 Terraform Apply 和 Azure Powershell 的两个 YAML 任务: enter image description here

我尝试了“Install-Module Az.Compute”,但我的管道显示了此错误:

管道错误消息: enter image description here

有关此问题的任何建议都会非常有帮助!

azure azure-devops devops azure-powershell cicd
1个回答
0
投票

错误原因是 Az Powershell 命令中的拼写错误:

Get-AzVM | Stop-AzVM -Force

而不是:

Get-AzureVM | Stop-AzVM -Force

如有疑问,请始终访问 Microsoft 文档:Az.Compute Module |微软学习

© www.soinside.com 2019 - 2024. All rights reserved.