Search code examples
azurepuppet

Setting Puppet extension on Azure VM


I am trying to add Puppet agent to an already existing Azure VM via Azure Powershell 1.0. The official documentation refers to use of the following:

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

I am trying to get -VM parameter out of Azure via get-AzureRmVm (which BTW returns details of the VM), but set-AzureVMPuppetExtension is not having it:

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

Solution

  • The problem you are having is that Set-AzureVMPuppetExtension expects the output from Get-AzureVM not Get-AzureRmVm

    This is the old service model, classic VMs, way of doing things. It has gotten considerably more complex now.

    Firstly to find the extension you want you need to use

    Get-AzureRmVMImagePublisher -Location $location  
    

    you can then use

     Get-AzureRmVMExtensionImageType -PublisherName puppetlabs -Location $location
    

    which will give you the details you need to use with

    Set-AzureRmVMExtension