Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM extension - The value of parameter typeHandlerVersion is invalid #125

Open
rzand opened this issue Sep 29, 2020 · 8 comments
Open

VM extension - The value of parameter typeHandlerVersion is invalid #125

rzand opened this issue Sep 29, 2020 · 8 comments

Comments

@rzand
Copy link

rzand commented Sep 29, 2020

Hello, I cannot get the azurestack_virtual_machine_extension working on a Windows VM.
The az vm extension image list --location someplace -o table command shows
Name Publisher Version


CustomScriptExtension Microsoft.Compute 1.9.3
CustomScript Microsoft.Azure.Extensions 2.0.6
CustomScriptForLinux Microsoft.OSTCExtensions 1.5.5

I used

publisher = "Microsoft.Compute"
type = "CustomScriptExtension"
type_handler_version = "1.9.3"

but keep getting the error:
Error: compute.VirtualMachineExtensionsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidParameter" Message="The value of parameter typeHandlerVersion is invalid." Target="typeHandlerVersion"

Can somebody please advise?
Thanks.

@rzand
Copy link
Author

rzand commented Oct 12, 2020

I solved the above by using
type_handler_version = "1.9"
instead of
type_handler_version = "1.9.3"
Regards.

@syunwei
Copy link

syunwei commented Sep 21, 2021

Thank you for sharing!!! Bumped into the same error because of version number as well.

@torbendury
Copy link

This is still an issue.

@kiazhi
Copy link

kiazhi commented May 6, 2022

Very interesting behaviour indeed. Bumped into this issue too.

Instead of the below:

publisher = "Microsoft.Azure.Diagnostics"
type = "IaaSDiagnostics"
type_handler_version = "1.20.0.1"

I have to specify it as below:

publisher = "Microsoft.Azure.Diagnostics"
type = "IaaSDiagnostics"
type_handler_version = "1.20"

@DeclanKainos
Copy link

Also experiencing this issue right now, setting to 1.9 doesnt fix it for me, i've tried several versions but my CSE still fails on Windows

@BrianWilkinsFL
Copy link

BrianWilkinsFL commented Oct 7, 2023

For anyone still experiencing this issue, we encountered it today. HashiCorp documentation on this provider is wrong and misleading.

See here

https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows

Look under the Admin Portal for the CustomScriptExtension version you are running. In my case, it is exactly like that link .. 1.10.x

For some reason it only wants the two digit version.

Additionally you need to fill out the virtual_machine_extension information as if you had sent via ARM:

“publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.10",

if you notice, that maps one for one with the terraform provider.

If I ever figure out the PS cmdlet to query the Marketplace Management to find this information then I may post it. Point though it can be found in the GUI and you just need the correct publisher name, type and version.

Once I did that, the problem went away and I was able to run my script.

This part here needs a warning or note to match the publisher and typeVersion for your Azure Stack:

resource "azurestack_virtual_machine_extension" "test" {
name = "hostname"
location = "West US"
resource_group_name = azurestack_resource_group.test.name
virtual_machine_name = azurestack_virtual_machine.test.name
publisher = "Microsoft.Azure.Extensions"
type = "CustomScript"
type_handler_version = "2.0"

settings = <<SETTINGS
{
"commandToExecute": "hostname && uptime"
}
SETTINGS

tags = {
environment = "Production"
}
}

https://registry.terraform.io/providers/hashicorp/azurestack/latest/docs/resources/virtual_machine_extension.html

This issue can be closed when HashiCorp terraform azurestack provider documentation is updated so not to confuse people. I believe the azurestack documentation person may have copied the information from azurerm. That likely works in azurerm but definitely the publisher is not right for azurestack.

@iyketheintrovert
Copy link

I encountered the same issue:

publisher            = "Microsoft.Compute"
  type                 = "CustomScriptExtension"
  type_handler_version = "1.9.5"

had to change to

type_handler_version =  "1.9"

before it worked

@benlavender
Copy link

benlavender commented Jun 10, 2024

Still an issue for myself, ended up having to right a function to replace() any values with more than two decimal places. Also automatic_upgrade_enabled has no affect either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants