Azure-chef-extension supports specifying a chef version now

Earlier azure-chef-extension used to install only the latest version of chef-client by default. In the latest releases, it allows to pass bootstrap_version option to specify the chef-client version.

Here’s how the option can be passed to the extension:

Azure Powershell ASM cmdlets:

a) When using Set-AzureVMExtension command, pass the bootstrap_version option in publicconfig.config file:

{
  "client_rb": "< your additions to the client.rb configuration >".
  "runlist":"< your run list >",
  "validation_key_format": "< plaintext|base64encoded >",
  "bootstrap_version": "< version of chef-client >",
  "daemon": "< none/service/task >"
  "environment_variables": {
    "< comma separated list of key-value pairs >"
  },
  "chef_daemon_interval": "< frequency at which the chef-client runs as service or as scheduled task >"
}

b) When using Set-AzureVMChefExtension command, pass -BootstrapVersion option. e.g.

Set-AzureVMChefExtension -ValidationPem <string> -Windows -VM <IPersistentVM> [-Version <string>] [-ClientRb <string>] [-BootstrapOptions <string>] [-RunList <string>] [-ChefServerUrl <string>] [-ValidationClientName <string>] [-OrganizationName <string>] [-BootstrapVersion <string>]

Azure Powershell ARM cmdlets
a) When using ARM template, please pass bootstrap_version option like this: https://github.com/Azure/azure-quickstart-templates/blob/master/chef-json-parameters-linux-vm/azuredeploy.json#L91

b) When using Set-AzureRmVMChefExtension command, pass -BootstrapVersion option. e.g.

Set-AzureRmVMChefExtension -ResourceGroupName "ResourceGroup001" -VMName "WindowsVM001" -ValidationPem "C:\my-org-validator.pem" -ClientRb "C:\client.rb" -RunList "Apache" -Windows -BootstrapVersion "12.5.1"

Azure XPLAT CLI cmdlets
When using azure vm extension set-chef command, pass --bootstrap_version option. e.g.

azure vm extension set-chef your-vm-name --validation-pem ~/chef-repo/.chef/testorg-validator.pem --client-config ~/chef-repo/.chef/client.rb --version "1210.12" -R 'recipe[your_cookbook_name::your_recipe_name]' --bootstrap_version "12.5.1"

Note: The same option --bootstrap_version works for both ASM and ARM mode in azure-xplat-cli.

KNIFE-AZURE plugin
When using knife-azure plugin, please pass --bootstrap-version option for both ASM and ARM commands.

#ASM Command
knife azure server create --azure-dns-name MyNewServerName --azure-vm-size Medium -I a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20150825-en.us-127GB.vhd --azure-service-location 'West US' --winrm-user myuser --winrm-password 'mypassword' --bootstrap-version "12.5.1"

#ARM Command
knife azurerm server create
  --azure-resource-group-name MyResourceGrpName
  --azure-vm-name MyNewVMName
  --azure-service-location 'westus'
  --azure-image-os-type centos
  --azure-image-reference-sku '6.5'
  --azure-vm-size Small
  -r "recipe[cbk1::rec1]"
  -c ~/.chef/knife.rb
  --bootstrap-version "12.5.1"