Instead of wasting any more time on it, I decided to give v1 and v2 provisioning drivers a chance, followed by Test Kitchen. IIRC they all use different drivers, and while all are pretty solid at provisioning Linux boxes, support for WinRM is very spotty.
Authentication:
First challenge is to authenticate successfully via provisioning driver. While Vagrant accepts subscription id and path to .pem as parameters, provisioning needs a azureProfile.json.To get that file generated, I installed azure-cli via brew `brew cask install azure-cli`
Next, import azure creds with `azure account import ../../Projects/Azure/myazure.publishsettings`
This command will generate the missing azureProfile.json in ~/.azure
Next, validate it works with `azure account list`
Chef-Provisioning piece:
Get a name of the box (ami) you'll be using: `azure vm image list | grep -i Win2012`Next, hack up the simplest recipe that'll spin up a box:
`knife cookbook create azure_old`
content of recipe/default.rb:
require 'chef/provisioning/azure_driver'
with_driver 'azure'
machine_options = {
:bootstrap_options => {
:cloud_service_name => 'alexvinyar', #required
:storage_account_name => 'alexvinyar', #required
:vm_size => "Standard_D1", #required
:location => 'West US', #required
:tcp_endpoints => '80:80' #optional
},
:image_id => 'b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_2-LTS-amd64-server-20150706-en-us-30GB', #required
# :image_id => 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-20150916-en.us-127GB.vhd', #next step
# Until SSH keys are supported (soon)
:password => 'Not**RealPass' #required
}
machine 'toad' do
machine_options machine_options
ohai_hints 'azure' => { 'a22' => 'b33' }
end
Finally, run chef-zero (chef client in local mode): `chef-client -z -r azure_old`
Once the run finishes (Azure is slow) connect to the box with `ssh root@12.23.34.45` for centos or ubuntu@ip for ubuntu boxes.
Now the Windows piece
With the `azure vm image list | grep -i Win2012` command I got a list of boxes, and once the test run with ubuntu succeeds, I move on to Windows.
This is where I took a break and had a beer. But I published this post anyway because I'll finish it eventually.
Useful links:
http://azure.microsoft.com/en-us/documentation/articles/xplat-cli/
http://brew.sh/
https://unindented.org/articles/provision-azure-boxes-with-vagrant/