Inside Out

And a VM in the clouds

So we got our shiny new box setup with vagrant-azure. It was as easy as a few commands…

sudo pacman -S vagrant vagrant plugin install vagrant-azure vagrant box add azure create our configurationmkdir azure-vm vagrant init gvim VagrantFile# create bunch of certificates for azure management and winrm# see up --provider=azure

Here's the gist for a [sample config](

If you're not sure which `vm_image` to use, you can get the list with `azure vm image list` after installing [azure command line tools for linux/mac](

**Two diagnostics tips that saved my morning :)**

- If you see error messages from `vagrant`, enable the [diagnostic logging]( with `export VAGRANT_LOG=debug`, rerun `vagrant up`
  • Now we’re onto the part where azure throws cryptic messages like InvalidXmlRequest :) With all the calmness, we monkeypatch and enable Net::HTTP.set_debug_output and examine the REQUEST and RESPONSE xmls. It takes a little trial and error to figure out winrm_https_port was empty in the configuration! This gist has a sample of monkey patch in the VagrantFile, just remove the comment from Net::HTTP.enable_debug!() (thanks to Config as code for the win!

**OK, the final awesomeness is...**

Linux host executing a powershell command on remote windows virtual machine on Azure

![Vagrant + Azure + Powershell + Chocolatey](/content/images/2015/02/vagrant_azure_powershell_chocolatey.jpg)

Wish there were a tool for Linux/Mac to create a persistent remote powershell session (just like ssh) to azure vm with WinRM!

You're in a happy corner. Take a moment. Breathe. Reflect. Did you hear the sound of silence?

© 2021 Inside Out. This work is licensed under a  CC-BY-NC-SA 4.0 License.