Skip to content

Instantly share code, notes, and snippets.



Created Sep 2, 2014
What would you like to do?
silly wrapper for azure vm list to a hash.
~$ azure vm list
info: Executing command vm list
data: DNS Name VM Name Status
data: -------------------------------- ----------- ---------
data: my-vm0 ReadyRole
data: my-vm1 ReadyRole
data: my-vm2 ReadyRole
data: my-vm3 NotReady
data: my-vm4 ReadyRole
data: my-vm5 ReadyRole
#!/usr/bin/env ruby
def get_vm_list()
vms = []
dork = %x[azure vm list| grep ReadyRole]
dork.eachline do |line|
vms = {:vm_name => line.split[2], :vm_state => line.split[3]}
return vms
vms.each do |vm|
puts vm.vm_name
puts vm.vm_state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment