chef/knife-azure

Error creating Ubuntu VM in ARM mode: typeHandlerVersion is invalid

matkam opened this issue · 6 comments

I'm trying to create a Ubuntu Linux VM in ARM mode with knife azurerm but I get the following error
The value of parameter typeHandlerVersion is invalid. (Code: InvalidParameter)
Any idea what a valid parameter is here?

My knife.rb includes the following options, with sensitive info replaced by 'xxx':

knife[:azure_subscription_id] = 'xxx'
knife[:azure_tenant_id] = 'xxx'
knife[:azure_client_id] = 'xxx'
knife[:azure_client_secret] = "xxx"

I'm running the gem (knife-azure-1.6.0.rc.0.gem) from the master branch. Here's the output from the knife command:

$ knife azurerm server create --azure-resource-group-name azuretoaws --azure-vm-name matttest4 --azure-service-location westus --azure-image-os-type ubuntu --ssh-user ubuntu --ssh-password Test123! -VV
INFO: Using configuration from /Users/matt/.chef/knife.rb
WARN: Azurerm subcommands are experimental and of alpha quality. Not suitable for production use. Please use ASM subcommands for production.
WARN: Azurerm subcommands are experimental and of alpha quality. Not suitable for production use. Please use ASM subcommands for production.
INFO:Resource Group azuretoaws already exist. Skipping its creation.
INFO:Adding new VM matttest4 to this resource group.
Creating Virtual Machine....
ERROR: At least one resource deployment operation failed. Please list deployment operations for details. Please see http://aka.ms/arm-debug for usage details.
DEBUG: /Users/matt/.chefdk/gem/ruby/2.1.0/gems/ms_rest_azure-0.2.3/lib/ms_rest_azure/azure_service_client.rb:72:in `get_long_running_operation_result'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/ms_rest_azure-0.2.3/lib/ms_rest_azure/azure_service_client.rb:85:in `get_put_operation_result'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/azure_mgmt_resources-0.2.1/lib/azure_mgmt_resources/deployments.rb:188:in `block in create_or_update'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/promise.rb:497:in `call'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/promise.rb:497:in `block in on_fulfill'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/safe_task_executor.rb:24:in `call'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `block in synchronize'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/synchronization/mri_lockable_object.rb:38:in `synchronize'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/safe_task_executor.rb:19:in `execute'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/promise.rb:527:in `block in realize'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `call'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:348:in `run_task'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:337:in `block (3 levels) in create_worker'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `loop'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:320:in `block (2 levels) in create_worker'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `catch'
/Users/matt/.chefdk/gem/ruby/2.1.0/gems/concurrent-ruby-1.0.2/lib/concurrent/executor/ruby_thread_pool_executor.rb:319:in `block in create_worker'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/logging-2.0.0/lib/logging/diagnostic_context.rb:448:in `call'
/opt/chefdk/embedded/lib/ruby/gems/2.1.0/gems/logging-2.0.0/lib/logging/diagnostic_context.rb:448:in `block in create_with_logging_context'

For anyone trying to reproduce this issue, I've modified the error handling code to display the error instead of crashing. I can create a PR for this later.

@matkam I tried to reproduce the error and get the same error only when I provide invalid version format for knife[:azure_chef_extension_version]. ARM API accepts only like 1210.12 as value and not like 1210.* for this parameter.
Please check what value did you provide.

@dheerajd-msys I was not aware I needed to provide a value for that parameter. Looks like adding knife[:azure_chef_extension_version] = '1210.12' to my knife.rb file does work around the issue. Is this parameter required? What happens for you when you don't provide it?

Now that the VM is created, how come knife azurerm is not bootstrapping the node even when I provide a run_list?

@matkam,
In a previous PR, we had fixed an issue about getting latest extension, if no version is passed.
can you verify the following code change is present at your side:- 8b6d686#diff-88e145c762bee1dec98ce94c1eb8ea76R725
knife azurerm command uses cloud-api protocol, so azure chef extension gets installed on the vm and no separate bootstrapping happens.
To confirm run_list execution, please check by logging into the vm.

@matkam - We found this issue in the latest changes on master branch. We will be making changes in the code to pick latest chef extension version if its not passed through option . Will update you once this change merged in master branch.

Thank you :)

@Vasu1105 Sounds good! Thank you :)
@dheerajd-msys I wasn't aware of cloud-api protocol. That's a nice feature actually.

@matkam This issue is resolved in this merge REF #360.