术语“Set-AzureRmVMPlan”未被识别为cmdlet的名称

术语“Set-AzureRmVMPlan”未被识别为cmdlet的名称,azure,azure-powershell,azure-automation,azure-marketplace,azure-vm-templates,Azure,Azure Powershell,Azure Automation,Azure Marketplace,Azure Vm Templates,我正在尝试在Azure自动化中使用powershell脚本在Azure上创建VM。此VM将从市场中创建。因此,我需要在脚本中使用cmdlet“Set-AzureRmVMPlan” $vm=New AzureRmVMConfig-VMName$inVMName-VMSize$VMSize 设置AzureRmVMPlan-VM$VM-Publisher kali linux-Product kali linux-名称kali 当我从Powershell ISE运行此脚本时,它工作正常。但是,当我将此

我正在尝试在Azure自动化中使用powershell脚本在Azure上创建VM。此VM将从市场中创建。因此,我需要在脚本中使用cmdlet“Set-AzureRmVMPlan”

$vm=New AzureRmVMConfig-VMName$inVMName-VMSize$VMSize

设置AzureRmVMPlan-VM$VM-Publisher kali linux-Product kali linux-名称kali

当我从Powershell ISE运行此脚本时,它工作正常。但是,当我将此命令放入Azure Automation Runbook时,Azure无法识别此命令。我得到下面的错误

Set-AzureRmVMPlan:术语“Set-AzureRmVMPlan”未被识别为 cmdlet、函数、脚本文件或

可操作程序。检查名称的拼写或路径是否正确 包括在内,请验证路径是否正确,然后重试

再说一遍

还原vhd备份时:8个字符:8

CategoryInfo:ObjectNotFound:Set-AzureRmVMPlan:String[],CommandNotFoundException

FullyQualifiedErrorId:CommandNotFoundException

因此,我进一步调查发现,该命令在“编辑PowerShell运行手册”页面的cmdlet列表中不可用,请参见下图

我还从下面的链接了解到,该cmdlet是去年添加到Azure Powershell中的


有人能帮我吗?

所以这里发生的事情是,Azure Automation使用了旧版本的模块,您必须转到Azure Automation刀片>资产>模块>浏览库并重新导入AzureRM.Profile和AzureRM.Compute


谢谢@4c74356b41,它成功了。我以前没有注意到这一点。