MSOpenTech/vagrant-azure — pull request #41 by devigned (2014-11-12 23:36:09+00:00)
Title: Fix for multibox parallel provisioning with same cloud service name

When creating 1 or more boxes using the same cloud service name (first time), Vagrant will try to build out the boxes in parallel. This will cause a race condition to determine if the box should try to build a new cloud service. The box that comes through second will lose when trying to build a cloud service. The below Vagrantfile should reproduce the issue.

```
Vagrant.configure('2') do |config|
config.vm.box = 'azure_basic_a2'

do_azure_stuff = Proc.new do |azure|
azure.mgmt_certificate = 'cert.pem'
azure.mgmt_endpoint = 'https://management.core.windows.net'
azure.subscription_id = 'subid'
azure.vm_image = 'a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201409.01-en.us-127GB.vhd'
azure.vm_password = 'blah'
azure.cloud_service_name = 'some_cloud_service'
azure.vm_location = 'West US'
azure.winrm_transport = %w(http https)
end

config.vm.define 'first' do |cfg|
cfg.vm.provider :azure do |azure|
azure.vm_name = 'myVM1234'
azure.tcp_endpoints = '3389:53389'
do_azure_stuff.call azure
end
end

config.vm.define 'second' do |cfg|
cfg.vm.provider :azure do |azure|
azure.vm_name = 'myVM1235'
azure.tcp_endpoints = '3389:53390'
do_azure_stuff.call azure
end
end

end
```

##Changes
- added a semaphore to wrap provisioning of a new cloud service / instance