vagrant-azure rspec ruby Rubygems

Enable Vagrant to manage virtual machines in Microsoft Azure

Vagrant Azure Provider

Gem Version

This is a Vagrant 1.7.3+ plugin that adds Microsoft Azure provider to Vagrant, allowing Vagrant to control and provision machines in Microsoft Azure.


Download Vagrant

Install the vagrant-azure plugin using the standard Vagrant 1.1+ installation methods. After installing the plugin, you can vagrant up and use azure provider. For example:

vagrant plugin install vagrant-azure --plugin-version '2.0.0.pre1' --plugin-prerelease
vagrant up --provider=azure

You’ll need an azure box before you can do vagrant up though.

Quick Start

You can use the dummy box and specify all the required details manually in the config.vm.provider block in your Vagrantfile. Add the dummy box with the name you want:

vagrant box add azure

Now edit your Vagrantfile as shown below and provide all the values as explained.

Vagrant.configure('2') do |config| = 'azure'

  # use local ssh key to connect to remote vagrant box
  config.ssh.private_key_path = '~/.ssh/id_rsa'
  config.vm.provider :azure do |azure, override|

    # use Azure Active Directory Application / Service Principal to connect to Azure
    # see:

    # each of the below values will default to use the env vars named as below if not specified explicitly
    azure.tenant_id = ENV['AZURE_TENANT_ID']
    azure.client_id = ENV['AZURE_CLIENT_ID']
    azure.client_secret = ENV['AZURE_CLIENT_SECRET']
    azure.subscription_id = ENV['AZURE_SUBSCRIPTION_ID']


Now you can run

vagrant up --provider=azure

This will bring up an Azure VM as per the configuration options set above.

You can now either SSH (if its a *Nix VM) using vagrant ssh, RDP (if its a Windows VM) using vagrant rdp or PowerShell vagrant powershell.

Normally, a lot of this options, e.g., vm_image_urn, will be embedded in a box file and you just have to provide minimal options in the Vagrantfile. Since, we’re using a dummy box, there are no pre-configured defaults.

Azure Boxes

The vagrant-azure plugin provides the ability to use Azure boxes with Vagrant. Please see the example box provided in example_box/ directory and follow the instructions there to build an azure box.

Please see Vagrant Docs for more details.


The vagrant-azure provide exposes a few Azure specific configuration options:


For instructions on how to setup an Azure Active Directory Application see: * tenant_id: Your Azure Active Directory Tenant Id. * client_id: Your Azure Active Directory application client id. * client_secret: Your Azure Active Directory application client secret. * subscription_id: The Azure subscription Id you’d like to use.


  • resource_group_name: (Optional) Name of the resource group to use.
  • location: (Optional) Azure location to build the VM – defaults to ‘westus’
  • vm_name: (Optional) Name of the virtual machine
  • vm_password: (Optional for *nix) Password for the VM – This is not recommended for *nix deployments
  • vm_size: (Optional) VM size to be used – defaults to ‘Standard_D1’. See:
  • vm_image_urn: (Optional) Name of the virtual machine image urn to use – defaults to ‘canonical:ubuntuserver:16.04.0-DAILY-LTS:latest’. See:
  • virtual_network_name: (Optional) Name of the virtual network resource
  • subnet_name: (Optional) Name of the virtual network subnet resource
  • instance_ready_timeout: (Optional) The timeout to wait for an instance to become ready – default 120 seconds.
  • instance_check_interval: (Optional) The interval to wait for checking an instance’s state – default 2 seconds.
  • endpoint: (Optional) The Azure Management API endpoint – default ‘’ seconds – ENV[‘AZURE_MANAGEMENT_ENDPOINT’].

Related Repositories



Enable Vagrant to manage virtual machines in Microsoft Azure ...



A working example of deploying Azure boxes with Vagrant ...



Automated deployment of TLS secured CoreOS (Vagrant or Azure) cluster ...

Top Contributors

devigned nagwanidheeraj jeffmendoza dividedmind vinyar jamesrenfro rgardler Snesha hkropp eisnerd SyntaxC4 icarocamelo lrolaz ramakrishnan ysaimanojkumar apestov codito mfdii lionelperrin ssugar


-   v2.0.0.pre1 zip tar
-   v1.3.0 zip tar
-   v1.2.1 zip tar
-   v1.2.0 zip tar
-   v1.1.0 zip tar
-   v1.0.5 zip tar
-   v1.0.4 zip tar
-   v1.0.3 zip tar
-   v1.0.2 zip tar
-   v1.0.1 zip tar
-   v1.0.0 zip tar