Skip to content

Instantly share code, notes, and snippets.

@ssugar
Last active August 29, 2015 14:19
Show Gist options
  • Save ssugar/34cefdb42c887eb8cd31 to your computer and use it in GitHub Desktop.
Save ssugar/34cefdb42c887eb8cd31 to your computer and use it in GitHub Desktop.
Get Vagrant working with Azure

#Set up Vagrant to use Azure provider#

###Install vagrant-azure plugin### vagrant plugin install vagrant-azure

###Install openssl### chocolatey install openssl.light -y

###Set up Azure Management Certificate### openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout az_cert.pem -out az_cert.pem openssl x509 -inform pem -in az_cert.pem -outform der -out az_cert.cer

Upload the resultant az_cert.cer file to Azure --> Manage Subcription --> Management Certificate --> Upload

###Set up VM Management Certificate### openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout vm_cert.key -out vm_cert.pem

###Create Azure dummy box### vagrant box add azure https://github.com/msopentech/vagrant-azure/raw/master/dummy.box

###Create Vagrantfile### Vagrant.configure('2') do |config| #Set the virtual machine 'box' to use config.vm.box = "azure"

   config.vm.provider :azure do |azure, override|
     override.vm.synced_folder ".", "/vagrant", disabled: true
	 azure.mgmt_certificate = "az_cert.pem"
	 azure.mgmt_endpoint = "https://management.core.windows.net"
	 azure.subscription_id = ""
	 azure.vm_image = "b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_5-LTS-amd64-server-20150204-en-us-30GB"
	 azure.vm_user = "vagrant"
	 azure.vm_password = ""
	 azure.vm_name = "azureVagrant"
	 azure.vm_location = "West US"
	 azure.private_key_file = "vm_cert.key"
	 azure.certificate_file = "vm_cert.pem"
	 azure.ssh_port = "22"
		
   end

   config.ssh.username = "vagrant"
   config.ssh.password = ""

end

###Bring up VM### vagrant up --provider=azure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment