在 Azure VM 上设置 Puppet 扩展

Setting Puppet extension on Azure VM

我正在尝试通过 Azure Powershell 1.0 将 Puppet 代理添加到现有的 Azure VM。官方文档是指使用以下内容:

Parameter Set: SetPuppetExtension
Set-AzureVMPuppetExtension [-PuppetMasterServer] <String> [[-Version] <String> ] [[-Disable]] [[-ReferenceName] <String> ] -VM <IPersistentVM> [ <CommonParameters>]

我正在尝试通过 get-AzureRmVm(顺便提一句 returns VM 的详细信息)从 Azure 中获取 -VM 参数,但是 set-AzureVMPuppetExtension 没有它:

Set-AzureVMPuppetExtension : Cannot bind parameter 'VM'. Cannot convert the "$VM" value of type "System.String" to type 
"Microsoft.WindowsAzure.Commands.ServiceManagement.Model.IPersistentVM".

您遇到的问题是 Set-AzureVMPuppetExtension 期望 Get-AzureVM 而非 Get-AzureRmVm

的输出

这是旧的服务模型、经典 VM 的处理方式。现在它变得相当复杂。

首先要找到你需要的扩展程序

Get-AzureRmVMImagePublisher -Location $location  

然后您可以使用

 Get-AzureRmVMExtensionImageType -PublisherName puppetlabs -Location $location

这将为您提供需要与

一起使用的详细信息
Set-AzureRmVMExtension