azure-powershell icon indicating copy to clipboard operation
azure-powershell copied to clipboard

Set-AzureRmVMExtension does not work

Open Vijayaraghavanl opened this issue 10 years ago • 2 comments

Unable to use Set-AzureRmVMExtension does not work and I run into the following error:

Set-AzureRmVMExtension : Cannot bind parameter because parameter 'TypeHandlerVersion' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3". At line:1 char:184

  • ... so.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" - ...
  •                                           ~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [Set-AzureRmVMExtension], ParameterBindingException
    • FullyQualifiedErrorId : ParameterAlreadyBound,Microsoft.Azure.Commands.Compute.SetAzureVMExtensionCommand

Below are the commands:

$Settings = '{"fileUris":[https://storageaccount.blob.core.windows.net/scripts/script.sh], "commandToExecute":"sh script.sh"}'

Set-AzureRmVMExtension -ResourceGroupName "rg-testvms1" -Location "East US" -VMName "testvm3" -Name "CustomScriptExtension" -Publisher "Contoso.Compute" -Type "CustomScriptExtension" -TypeHandlerVersion "1.1" -SettingString $Settings;

Vijayaraghavanl avatar Dec 14 '15 08:12 Vijayaraghavanl

@Vijayaraghavanl Looks like the type parameter is actually called -ExtensionType and we need to alias it correctly and update the examples. @hyonholee Can we improve the error message as well?

singhkays avatar Dec 29 '15 20:12 singhkays

Good Catch.. I just used the examples as in https://msdn.microsoft.com/en-us/library/mt603745.aspx.... Thanks for pointing out.. Cheers!!

Vijayaraghavanl avatar Dec 30 '15 04:12 Vijayaraghavanl