Tuesday, February 24, 2015

Vagrant Azure Provider is now Platform Independent [feedly]

Vagrant Azure Provider is now Platform Independent
// MS Open Tech

vagrant_logoThe Vagrant community has been happily using the Vagrant Azure Provider to deploy Vagrant boxes to Microsoft Azure for a while now. However, in order to provision Windows VMs it was necessary to use a Windows client as we used PowerShell remoting for provisioning the box. We are pleased to report that when using the latest Vagrant Azure provider this is no longer the case. Linux and Mac users can now deploy and provision both Windows and Linux VMs on Microsoft Azure using Vagrant.

This improvement come to us courtesy of some great work in the Ruby 'WinRM' Gem as well as a sizable community contribution to the Vagrant Azure plugin from David Justice. We have also taken the opportunity to merge some other community provided enhancements. These include:

  • Support provisioning of Windows VMs using WinRM
  • Allow execution of PowerShell scripts on Windows VM during provisioning
  • Ensure Chef users can make use of Vagrant Omnibus
  • Support for rsync during provisioning
  • Ability to connect a VM to a virtual network
  • Documentation for the Multi Machine feature

As you would expect, this release also fixes a few edge case bugs..

Getting started with this plugin is straightforward for anyone already familiar with Vagrant (version 1.6.0 or higher). First, you need to install the plugin:

vagrant plugin install vagrant-azure

In order to use the plugin you will need to provide an Azure Vagrant box. You can define your own box or use the provided dummy box by adding it to your Vagrant client as follows:

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

This box is configured in the config.vm.provider section of your Vagrantfile as follows:

Vagrant.configure('2') do |config|     config.vm.box = 'azure'     config.vm.provider :azure do |azure|         azure.mgmt_certificate = 'YOUR AZURE MANAGEMENT CERTIFICATE'         azure.mgmt_endpoint = 'https://management.core.windows.net'         azure.subscription_id = 'YOUR AZURE SUBSCRIPTION ID'         # Storage account to us. A new account will be created if blank.         azure.storage_acct_name = 'NAME OF YOUR STORAGE ACCOUNT'            # Azure image to use         azure.vm_image = 'NAME OF THE IMAGE TO USE'         # username defaults to 'vagrant' if not provided         azure.vm_user = 'PROVIDE A USERNAME'          # password: min 8 characters. should contain a lower case letter,          # an uppercase letter, a number and a special character         azure.vm_password = 'PROVIDE A VALID PASSWORD'          # max 15 characters. contains letters, number and hyphens.          # Can start with letters and can end with letters and numbers         azure.vm_name = 'PROVIDE A NAME FOR YOUR VIRTUAL MACHINE'             # Cloud service to use, defaults to same as vm_name.          # Leave blank to auto-generate         azure.cloud_service_name = 'PROVIDE A NAME FOR YOUR CLOUD SERVICE'          # Deployment name (used in portal and CLI tools) defaults to cloud_service         azure.deployment_name = 'PROVIDE A NAME FOR YOUR DEPLOYMENT'          # Data centre to use e.g., West US         azure.vm_location = 'PROVIDE A LOCATION FOR VM'          azure.private_key_file = 'PATH TO YOUR KEY FILE'         azure.certificate_file = 'PATH TO YOUR CERTIFICATE FILE'           # Provide the following values if creating a *Nix VM         azure.ssh_port = 'A VALID PUBLIC PORT'           # Provide the following values if creating a Windows VM         # Open up winrm ports on both http (5985) and http (5986) ports         azure.winrm_transport = [ 'http', 'https' ]          # customize the winrm https port, defaults to 5986         azure.winrm_https_port = 'A VALID PUBLIC PORT'         # customize the winrm http port, defaults to 5985          azure.winrm_http_port = 'A VALID PUBLIC PORT'          # opens the Remote Desktop internal port (53389).          # Without this, you cannot RDP to a Windows VM.         azure.tcp_endpoints = '3389:53389'        end         # SSH username and password used when creating the VM       config.ssh.username = 'YOUR USERNAME'        config.ssh.password = 'YOUR PASSWORD'   end


You should, of course, add any provisioning you want using the standard Vagrant provisioning mechanisms. Now you can simply provide the name of the Vagrant Azure provider when running "vagrant up", e.g.:

vagrant up --provider=azure

Having completed these steps you will have a Virtual Machine deployed and configured on Microsoft Azure using Vagrant.


Shared via my feedly reader

Sent from my iPhone

No comments:

Post a Comment